Results 1 to 4 of 4

Thread: Flash redirect url

  1. #1
    232
    posts
    Registered User

    Flash 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?

  2. #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.

  3. #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");

  4. #4
    232
    posts
    Registered User
    Gaaah! 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! ;]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012