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

calling javascript function with navigateToURL

Engaged ,
May 29, 2008 May 29, 2008
In AS2 I could call a javascript pop up function from flash with the geturl. But it's not working with AS3's navigateToURL. Here's my code:

var UrlRequest:URLRequest = new URLRequest("javascript:MM_openBrWindow(' http://www.djgecko.com/mp3/17_ice_hopper.mp3','DJGecko','top=' + ((screen.availHeight/2)-(200/2)) + ',left=' + ((screen.availWidth/2)-(400/2)) + ',status=yes,resizable=yes,width=400,height=200')");

navigateToURL(UrlRequest);


And here is my javascript code:

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>

When I paste the url string in my browser the pop up works. When I test the swf in the Flash app it opens up a browser window and tries to run the function, but it of course doesn't work. When I open the .swf in a browser, embedded in the page with the javascript function, nothing happens. Can someone help?

Thanks!
TOPICS
ActionScript
2.5K
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

Engaged , May 30, 2008 May 30, 2008
pointing the navigateToURL to _self has fixed the problem.

ex:

navigateToURL(UrlRequest, "_self");



Translate
New Here ,
May 29, 2008 May 29, 2008
navigateToURL(URLRequest);

Even without embedding the Javascript to open a new browser window, I cannot get this to work properly.

My code is pretty simple:

dooWop_btn.addEventListener(MouseEvent.CLICK, goToTvPledge);

function goToTvPledge(e:Event):void
{
var tvPledgeRequest:URLRequest = new URLRequest("https://pledge.wusf.usf.edu/wusftvdefault.asp?p=TVWEB");
navigateToURL(tvPledgeRequest);
}

But when I click on the frame or frames that this AS applies to, I get the Pop-up blocked message when in IE 7. I really need to find out how to get around this, because most of my site visitors are still using IE.

Sorry, I haven't resolved your issue, but your question would have been my next one...How can I incorporate the Javascript to Open a New Browser Window to get some control of the size and to get around the Pop-up blockers. I really didn't even request a pop-up this time. Don't know why I'm getting this error....

Can anyone help?

WCW
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
Engaged ,
May 30, 2008 May 30, 2008
LATEST
pointing the navigateToURL to _self has fixed the problem.

ex:

navigateToURL(UrlRequest, "_self");



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