Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Opening an external link using javascript. Keeping new window in front

Community Beginner ,
Aug 08, 2011 Aug 08, 2011

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

TOPICS
ActionScript
582
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 08, 2011 Aug 08, 2011

:


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 ...
Translate
Community Expert ,
Aug 08, 2011 Aug 08, 2011

:


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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 09, 2011 Aug 09, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2011 Aug 09, 2011
LATEST

you're welcome.

check the adobe help files/actionscript 3 classes/externalinterface.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines