0
Engaged
,
/t5/animate-discussions/calling-javascript-function-with-navigatetourl/td-p/333812
May 29, 2008
May 29, 2008
Copy link to clipboard
Copied
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!
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Engaged
,
May 30, 2008
May 30, 2008
pointing the navigateToURL to _self has fixed the problem.
ex:
navigateToURL(UrlRequest, "_self");
ex:
navigateToURL(UrlRequest, "_self");
New Here
,
/t5/animate-discussions/calling-javascript-function-with-navigatetourl/m-p/333813#M9022
May 29, 2008
May 29, 2008
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
LATEST
/t5/animate-discussions/calling-javascript-function-with-navigatetourl/m-p/333814#M9023
May 30, 2008
May 30, 2008
Copy link to clipboard
Copied
pointing the navigateToURL to _self has fixed the problem.
ex:
navigateToURL(UrlRequest, "_self");
ex:
navigateToURL(UrlRequest, "_self");
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

