Results 1 to 4 of 4
Thread: Flash redirect url
-
May 9th, 2012, 06:11 AM #1232Registered User
postsFlash redirect url
How can I redirect the user to a different address, w/o him clicking on it and his browser not blocking it as a popup? Basically after some event, I want to automatically go to a different website w/o the users interaction, but when I use a simple URLRequest with navigateToURL, every browser blocks it as a popup.
Can it be done?
-
May 9th, 2012, 10:57 AM #2
I'm not sure what you have done wrong?
I made a project with standard flash export settings and it worked directly?
I've tried it locally and on a live server.
Here is the code:
Code:import flash.display.MovieClip;import flash.events.MouseEvent; var buttonA:MovieClip = new MovieClip(); this.addChild(buttonA); buttonA.graphics.lineStyle(3,0x00ff00); buttonA.graphics.beginFill(0x0000FF); buttonA.graphics.drawRect(0,0,100,100); buttonA.graphics.endFill(); buttonA.x = stage.stageWidth/2-buttonA.width/2; buttonA.y = stage.stageHeight/2-buttonA.height/2; buttonA.addEventListener(MouseEvent.CLICK, traceCall); function traceCall(e:MouseEvent) { trace("button called"); navigateToURL(new URLRequest("http://www.google.com")); }Last edited by lnsiu; May 9th, 2012 at 10:59 AM.
ECMAscript
-
May 9th, 2012, 11:07 AM #3
if you want to use the same web page, the site is blocked trying the fla locally, but do work live on a server.
Code:navigateToURL(new URLRequest("http://www.google.com"), "_self");
ECMAscript
-
May 9th, 2012, 12:05 PM #4232Registered User
postsGaaah! I dunno what happened, but now it works. Maybe it's because I forgot to add "_self", and the browser interpreted it as a popup.
Either way, thank you very much Insiu! ;]

Reply With Quote

Bookmarks