dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How do I remove Timer events externally?

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    3

    How do I remove Timer events externally?

    I was wondering if anyone can show me how to remove EventListener externally?

    My set up is this: There is a master .fla file that loads multiple swf files consecutively with loader class. In this master .fla file, there is a next button that unloads the current swf file playing and loads the next swf file so the viewer can choose to fastforward to the next movie.

    On one of the swf files (Scene3.swf) there is a Timer event going through the length of the movie. (It is a animation of a bubble floating in the background every 100 milliseconds or so). Within the movie the Timer is stopped and eventListener removed at the end of the movie. Everything is ok until I click on the next button while this movie is playing...I get an error saying:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Scene3_fla::stage3_1/bubbleTween()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()


    I presume it's because the processor is still processing the movie. Well, the next button unloads each move when it's clicked, and the child is removed also. I want to tell the next button (which is in the master .fla file) to remove the Timer event with removeEventLister in the externally loaded swf file (Scene3.swf).

    Would I set up a document class for the Timer event? If so how? Or is there a way to access the Timer event externally? Please advise!!!

    JK

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I want to tell the next button (which is in the master .fla file) to remove the Timer event with removeEventLister in the externally loaded swf file (Scene3.swf)
    No, you don't. You want to have Scene3.swf be smart enough to stop its timer when it's unloaded. To do this, you can add an event listener for the UNLOAD event which calls a function which will stop the timer and remove the timer listener. This way the main swf never needs to know the guts of the loaded swfs.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center