Skip navigation
ajlayne
Currently Being Moderated

Navigatetourl won't open in same window and in infinite refresh

Jul 6, 2013 1:16 PM

Tags: #as3 #3.0 #action_script_3 #actionscript #flash_professional #flash_cs6

I have a project that requires a skip button and to go to a specified url in the same window once the animation is complete. The button works, however the navigatetourl in the last frame is not behaving.

 

Here is the code I've placed in the last frame:

 

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

 

function fl_EnterFrameHandler(event:Event):void

{

    //Start your custom code

    // This example code displays the words "Entered frame" in the Output panel.

   

    navigateToURL(new URLRequest("http://www.student.nvcc.edu/home/amlayne/ite170/dreamweaver/graded_ass ignments/index.html"), "_self");

;

    stop();   

    // End your custom code

}

 

I've tried moving it to an earlier frame, placing a stop in the earlier frame, moving the stop command to after and so on. No matter what I do, the new url opens in a new window and is in a constant state of refresh. I also have the loop turned off but the animation begins to load the first frame again anyway.  Please help. I've tried many fixed listed in forums that are all about the same with no different results.  You can view my animation here: http://www.student.nvcc.edu/home/amlayne/ite170/flash/graded%20assignm ents/myintro.html

 

NOTE: You will have to close the browser to get the refresh to stop.

 

I've been working on this one issue two days and am at a complete loss.

 
Replies
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 6, 2013 1:34 PM   in reply to ajlayne

    the enterframe event is repeatedly dispatched multiple times per second (equal to your frame rate) and that's not what you want.

     

    replace all your posted code with:

     

    navigateToURL(new URLRequest("http://www.student.nvcc.edu/home/amlayne/ite170/dreamweaver/graded_*** ignments/index.html"), "_self");

    stop();

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 6, 2013 5:01 PM   in reply to ajlayne

    you're welcome.

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 7, 2013 5:32 PM   in reply to ajlayne

    there's no problem with that code.

     

    you just need an object with reference btnSkip1 to exist at the time that code executes AND the same object needs to exist when you click it.

     

    there are a few ways that can be screwed-up and only two to ensure it's done correctly: 

     

    1.  create that object with actionscript and never null it.

    2.  create it in the ide when some frame plays, execute that code in the same frame and do not remove btnSkip1 thereafter.

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 7, 2013 6:03 PM   in reply to ajlayne

    create a new fla that contains btnSkip1 and that code.  publish a swf and html.  test.

     

    any problem?

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 7, 2013 8:46 PM   in reply to ajlayne

    you're welcome.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points