Copy link to clipboard
Copied
I am displaying a photo from an external link when called upon from my swf. When the user clicks a button, up pops a corresponding photo in a new browser window. After the photo window has opened, if the user clicks another button the photo browser will update but its no longer in front. I know I need to use the focus() command but cannot figure how to incorporate it into my AS3 code.
var req=new URLRequest();
function scrollPanePopulate(event:Event){
//create the temp variables
var calledPhoto=pntxml.row[pointindex].PhotoUrl;
req=pntxml.row[pointindex].PhotoUrl;
var jscommand:String = "var newwin=window.open('"+req+"','win','height=400,width=600,left=650,top=50,toolbar=no,scrollbars=yes,location=no');";
var url:URLRequest = new URLRequest("javascript:" + jscommand +"void(0);"); navigateToURL(url, "_self");
}
The above code works great but I want to keep the photo window in front when it is refreshed. Any suggestions?
thanks in advance...
-josh
1 Correct answer
:
var req=new URLRequest(); function scrollPanePopulate(event:Event){ //create the temp variables var calledPhoto=pntxml.row[pointindex].PhotoUrl; req=pntxml.row[pointindex].PhotoUrl; var jscommand:String = "var newwin=window.open('"+req+"','win','height=400,width=600,left=650,top=50,toolbar=no,scrollbars=yes,location=no');"; var url:URLRequest = new URLRequest("javascript:" + jscommand +"void(0);
newwin.focus();
");
navigateToURL(url, "_self");
}
// p.s. you should ...
Copy link to clipboard
Copied
:
var req=new URLRequest(); function scrollPanePopulate(event:Event){ //create the temp variables var calledPhoto=pntxml.row[pointindex].PhotoUrl; req=pntxml.row[pointindex].PhotoUrl; var jscommand:String = "var newwin=window.open('"+req+"','win','height=400,width=600,left=650,top=50,toolbar=no,scrollbars=yes,location=no');"; var url:URLRequest = new URLRequest("javascript:" + jscommand +"void(0);
newwin.focus();
");
navigateToURL(url, "_self");
}
// p.s. you should be using externalinterface class.
Copy link to clipboard
Copied
Thanks KGLAD. That work great!
I've never worked with the externalinterface class so I am not sure what you mean by that. Any suggestions as to where I could get started learning more?
-josh
Copy link to clipboard
Copied
you're welcome.
check the adobe help files/actionscript 3 classes/externalinterface.

