Removing event listeners on leaving a frame

Hi team,
I am having a bit of trouble, I have l modded some code that I am really happy with, it makes buttons bounce around for the user to try to click on when entering a certain frame...
Problem.. I notice tha the code adds eventlisteners ENTER_FRAME to make this work, when you leave that frame there are now problems with null objects becuase the listeners are still on but the objects are not there anymore..
Ok so attempted solution - I can use a currentLabel on the main timeline to check if the correct frame is reached then use a function if (label is x) put listeners on else take them off... works but then I have to have these objects hidden on the timeline  and then add visible=true/false to my framelabel listener.. This works but part of my functionality here is that these movieclips that move are buttons that the user clicks on and they explode and dissapear- but now they dont because I have a code that says on that frame they should be visible..
The only thing I can think of is to have a blank frame at the end of the explode and put a stop on it.  Then add a gotoAndPlay(1) into my frame label code.  Seems very ugly, you guys got a better way?  Can I remove eventlisteners on leaving a frame?  Is there a code like LEAVE_FRAME????
cheers
sub

yes, it goes in the keyframe where those movieclips exist.  if the movieclips exist on a main timeline frame, that's where that code should be placed.
that code should execute when the movieclip exists.  the listeners wait for the movieclips to be removed from the display list.  that happens when you navigate away from the frame that contains those movieclips.

Similar Messages

  • Removing Event Listeners - Are they needed all the time

    My goal is to increase the performance of my project so I would like to know if it is always a good idea to remove event listeners. More specifically, lets say I have a movie with severals scenes and several frames within those scenes. Each one of the frames has an event listener:
    Example:
    Scene 1
    Frame 1 (EventListener)
    Frame 2 (EventListener)
    Frame 3 (EventListener)
    Frame 4 (EventListener)
    Scene 2
    Frame 1 (EventListener)
    Frame 2 (EventListener)
    Frame 3 (EventListener)
    Frame 4 (EventListener)
    Questions:
    Does Flash continue to listen for an event in Scene 1/Frame 1 when the playhead has moved to Scene 1/ Frame 2?
    Or does Flash just listen for the events when the playhead is in a particular frame only?
    Should I remove the event listener once I leave a particular frame (should there be remove event listeners on each frame)?

    Just mentioning, the addEventListener comes with a parameter you can set to true or false called a weak reference. On desktop flash apps it can become time consuming to constantly remove listeners, especially when things drop off the display list frame to frame. You can mark them for automatic garbage collection by using the weak reference property.
    e.g.
    Credits_bnt.addEventListener(MouseEvent.CLICK, goCredits, false, 0, true); // set weak reference to true (e.g. remove when no references exist anymore automatically)
    Eventually garbage collection will remove that reference automatically when there's nothing left on the display list or in memory to use it.
    However, if this is targeted at mobile, you absolutely want to remove the reference as soon as possible when it's not needed for memory conservation. On a desktop it's not that big of a deal.

  • Remove Event Listeners (at the right time)

    I have a app which loads multiple flv's, I also have a timer
    (digial) which shows how long the movie has been played for. The
    problem is that whenever i load and new move (through the same
    "loadVideos()" function, the timer variables ("lagTime", "endTime")
    are not reset (even though the correct variables are being passed.
    I believe it has something to do with the event listeners which are
    being used to load the movies. How can i clear all the listerner
    before reloading the movies?
    Here is a code snippet:
    Thanks in advance

    Thanks, kglad
    Yes it traces 'endTime' but what happens is that when i play
    the first movie is will display for example ("40,40,40,40" etc...)
    until the video stops playing. If i load another movie it will then
    trace ("40, 20, 40, 20, 40" etc...) so i need to kill the
    listereners and reload the variables.
    Jake

  • Removing Event Listeners

    Hello!
    I have a PopUpManager window that fires an event just before closing (not the CloseEvent).
    I am listening for that event and handling it in a function.
    Q: Is it best practice to remove the listener in the function that handles it or calling PopUpManager.removePopUp on that popup automatically does the "cleaning" as well?
    Thank you!

    Removing the eventListeners on a popup window is necessary I believe.
    In your event handling function, you can remove the event listener by event.target.removeEventListener(..., ...). It doesn't matter that your component is handle by the popUpManager, you'll still have a reference to it.
    Example
    In main app:
    var win:myClass = PopUpManager.createPopUp(this, myClass, true) as myClass;
    win.addEventListener("myEvent", myHandler);
    private function myHandler(evt:Event):void
         evt.target.removeEventListener("myEvent", myHandler);
    In custom myClass:
    private function handleSomething(evt:Event):void
                    var ev:Event = new Event("myEvent");
                    dispatchEvent(ev);
                    if (isPopUp)
                        PopUpManager.removePopUp(this as IFlexDisplayObject);
    Does this help?
    Dany

  • Does removeChild remove the object's event listeners?

    Hi
    If you dynamically create a parent movieclip, and dynamically add a color picker to each clip, and add an event listener for each color picker, does a removeChild on the parent movieClip remove event listeners belonging to any of it's children?
    Thanks
    Shaun

    Ahh - thanks Ned
    Is there any software you could recommend that monitors and shows you what or how many event listeners are open, memory consumption etc, to help you to trim the fat from your coding?
    Thanks
    Shaun

  • Listeners - Entering a Frame and leaving a Frame to Call a function

    OK, I am trying to get the following functions to load and unload the video to my main timeline when I go in and out of a frame. I tried on Enter_FRAME but it is now working properly and load many instances.
    What are the listeners I need to do to call the functions of oCoach when enetering a frame and fclickCV when leaving a frame? Many thanks in advance!
    //========Scenario Movie===================
    var pCoach:coach_mc = new coach_mc();
    var spriteCoach:Sprite= new Sprite();
    spriteCoach.x = 5;
    spriteCoach.y = 30;
    //----------open scenario---------
    function oCoach(myevent:MouseEvent):void{
         stage.addChild(spriteCoach);
         spriteCoach.addChild(pCoach);
        pCoach.myVideo = myVideo1;
         pCoach.my_ns.play(myVideo1);
         coach_btn.visible = false;
    //     pCoach.scenario_txt.htmlText = myScenario;
    stage.addEventListener(Event.ENTER_FRAME,oCoach);
    //coach_btn.addEventListener(MouseEvent.CLICK,oCoach);
    function fclickCV(myevent:MouseEvent):void{
         coach_btn.visible = true;
         pCoach.my_ns.close();
         stage.removeChild(spriteCoach);
         pCoach.removeChild(videoVO);
         pCoach.clearInterval(loaded_interval);
    pCoach.closeCoach_btn.addEventListener(MouseEvent.CLICK,fclickCV);
    forward_btn.addEventListener(MouseEvent.CLICK,fclickCV);
    back_btn.addEventListener(MouseEvent.CLICK,fclickCV);

    enterframe and exitframe are loops.  they aren't one time events like their names suggest.
    to execute code upon entering a frame, attach the code to the frame or, better, create a function containing the code and call that function from the frame.  to execute code upon exiting a frame, create an object that is removed from the display list when you exit the frame.  you can then apply a removedfromstage listener to the object to call a function that will execute when exiting the frame.

  • Managing various event listeners in multi-frame movie

    I'm working on a gunslinger game. I have numerous frames
    which correspond to different stages of the game. The frame that
    corresponds to the actual gameplay has a really involved
    ENTER_FRAME function attached to particular item on the stage. When
    the game is over (or an error occurs, or the network connection
    fails) I want to leave the gameplay frame and move to some other
    frame. When this happens, I would like the ENTER_FRAME function on
    the gunslinger to be removed because the player may finish a game
    and then re-enter the gameplay frame later after selecting a new
    opponent.
    QUESTION: Can anyone recommend a good way to manage the
    keyboard event listeners, all the button event listeners, etc? As
    you might imagine, I have no reliable way to determine which frame
    might be entered after the gameplay frame because the frame change
    could be triggered by a variety of different reasons.

    I have tried using hasEventListener to check for an existing
    ENTER_FRAME function before adding the event listener again but it
    never seems to notice that there is an existing enterframe function
    running. Furthermore, when I leave the frame, the enterframe
    function (which is attached to a particular movie clip on frame 2)
    continues to run even though that movie clip doesn't exist on any
    other frame in the flash movie.
    The first frame in my movie just has a button that takes the
    movie to frame 2. frame 2 has a movie clip (myMovie) and a button
    (btnFrame1) which goes back to frame 1. It also has the attached
    actionscript.
    I start the movie.
    I click 'goto frame 2'
    the enterframe listener is added and starts to output trace
    statements of the current frame of myMovie (e.g., 1-2-3).
    i click 'goto frame 1' on the main movie
    although i am looking at frame 1 of my main movie which has
    no instance of myMovie, the enterframe function keeps tracing the
    current frame--interestingly, the frame of myMovie does not
    advance...it stays on 1, 2, or 3 and announces that frame over and
    over again.
    Repeating the visit to frame 1 and frame2 over and over again
    results in more listeners being added over and over again.
    I have uploaded a sample FLA here:
    http://jaith.net/questions/listenerExample.zip
    I hope that you might help me determine how to remove the
    listener upon exiting this frame. I don't want that enterframe
    function running (and referring to movieclips that don't exist)
    when I exit the frame where it is relevant. I'm wondering if I
    should try adding the event listener to the root movie
    instead.

  • Removing a Button Event Listener on a Specific Frame and Reactivating it on Next Frame

    Hi , i am trying to develop a Slideshow where Next Button needs to behave in a certain way on a specific Frame , lets say a Specific Condition is met only then Next Button would work , I have been able to achieve that but problem is the Button Retains its Event Listener even on the next Frame , whereas  i have already included removeEventListener on the next frame with a new Function for the button , but its doesnt take it like that.
    Can anyone help please ?

    Hello Ned,
    I have fixed the issue with few Frame , but where we have the conditions to be met on two consecutive frames , I am not able to achieve that.
    here is the Code on my first Frame.
    FRAME1
    stop();
    slidecounter.text = String(this.currentFrame - 1 + "/" + indexframe);
    mc_prog.width = 0;
    //LIBRARIES TO BE IMPORTED ///////////////////////////////////////////////////////////
    import flash.events.MouseEvent;
    //VARIALBLES INITIATED
    var score:Number = 0;
    var questions:Number = 0;
    var qtotal:Number = 11;
    var attempt:Number = 0;
    var indexframe:int;
    indexframe = this.totalFrames - 1;
    var notes:Array = new Array();
    var count:int;
    count = 0;
    var backcounter:int;
    backcounter = 0;
    var count2:int;
    count2 = 0;
    var backcounter2:int;
    backcounter2 = 0;
    var count3:int;
    count3 = 0;
    var backcounter3:int;
    backcounter3 = 0;
    // MOVIE CLIPS INITITATED ////////////////////////////////////////////////////////////////
    var volbutton1:volcontrol;//VOLUME BUTTON ROLLOVER MOVIE CLIP
    volbutton1 = new volcontrol();
    var clist:courselist;//VOLUME COURSE LIST ROLLOVER MOVIE CLIP
    clist = new courselist();
    var pop1:Mc_slide9 = new Mc_slide9;
    pop1 = new Mc_slide9;
    var pop2:Mc_slide13 = new Mc_slide13;
    pop2 = new Mc_slide13;
    var pop3:Mc_slide17 = new Mc_slide17;
    pop3 = new Mc_slide17;
    //BUTTONS INITIATED
    btn_nxt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame);//NEXT SLIDE BUTTON
    btn_bck.addEventListener(MouseEvent.CLICK, backbtn);//BACK BUTTON
    btn_loc.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage); //LIST OF COURSES BUTTON
    btn_notice1.addEventListener(MouseEvent.CLICK, loadnotice1);
    pop1.closebtn.addEventListener(MouseEvent.CLICK, unloadbtn1);
    btn_notice2.addEventListener(MouseEvent.CLICK, loadnotice2);
    pop2.closebtn.addEventListener(MouseEvent.CLICK, unloadbtn2);
    btn_notice3.addEventListener(MouseEvent.CLICK, loadnotice3);
    pop3.closebtn.addEventListener(MouseEvent.CLICK, unloadbtn3);
    //VOLUME BUTTON ROLL OVER FUNCTION EVENT LISTENERS ///////////////////////////////////////
    btn_vol.addEventListener(MouseEvent.ROLL_OVER,vol);
    btn_vol.addEventListener(MouseEvent.ROLL_OUT,volout);
    btn_loc.addEventListener(MouseEvent.ROLL_OVER,coursel);
    btn_loc.addEventListener(MouseEvent.ROLL_OUT,corlist);
    // FUNCTIONS INITIATED /////////////////////////////////////////////////////////////////
    function fl_ClickToGoToNextFrame(event: MouseEvent): void
      nextFrame();
    function backbtn(event:MouseEvent):void{
       prevFrame();
    function fl_ClickToGoToWebPage(event: MouseEvent): void {
      navigateToURL(new URLRequest("https://www.onlineinduction.com/fmgl/courselist.php?ist=2&type=Vendor Employee Inductions"), "_self");
    //VOLUME BUTTON ROLLOVER EFFECT FUNCTION
    function vol(e:MouseEvent):void
      addChild(volbutton1);
      //popup_instance.width = 675;
      //popup_instance.height = 300;
       if(this.currentFrame == 2)
        volbutton1.x = 150;
        volbutton1.y = 528;
       else{
        volbutton1.x = 278;
        volbutton1.y = 528;
      function volout (e:MouseEvent):void {
        removeChild(volbutton1);
       function coursel(e:MouseEvent):void {
       addChild(clist);
        if(this.currentFrame == 2)
         clist.x = 85;
         clist.y = 532;
        else if(this.currentFrame == 5){
         clist.x = 115;
         clist.y = 325;
        else{
         clist.x = 175;
         clist.y = 532;
      function corlist (e:MouseEvent):void {
        removeChild(clist);
    function loadnotice1(Event:MouseEvent):void//FRAME 9 FUNCTION FOR IMPORTANT NOTICE
      if ( count == 1 && stage.contains(pop1))
       removeChild(pop1);
        if(count == 1)
         nextFrame();
        else
         addChild(pop1);
         pop1.x = 40;
         pop1.y = 120;
         count = 1;
      trace("Counter Value:" + count);
    function loadnotice2(Event:MouseEvent):void//FRAME 9 FUNCTION FOR IMPORTANT NOTICE
      if ( count2 == 1 && stage.contains(pop2))
       removeChild(pop2);
        if(count == 2)
         nextFrame();
        else
         addChild(pop2);
         pop2.x = 40;
         pop2.y = 120;
         count2 = 1;
      trace("Counter Value:" + count);
    function loadnotice3(Event:MouseEvent):void//FRAME 9 FUNCTION FOR IMPORTANT NOTICE
      if ( count3 == 1 && stage.contains(pop3))
       removeChild(pop3);
        if(count == 3)
         nextFrame();
        else
         addChild(pop3);
         pop2.x = 40;
         pop2.y = 120;
         count2 = 1;
      trace("Counter Value:" + count);
    function nextframe9(event: MouseEvent): void
        if(count == 1 && stage.contains(pop1) )
           removeChild(pop1);
        if(count == 1)
         nextFrame();
        else
         addChild(pop1);
         pop1.x = 40;
         pop1.y = 120;
         count = 1;
    function nextframe13(event: MouseEvent): void
        if(count2 == 1 && stage.contains(pop2) )
           removeChild(pop2);
        if(count2 == 1)
         nextFrame();
        else
         addChild(pop2);
         pop2.x = 40;
         pop2.y = 120;
         count2 = 1;
    function nextframe17(event: MouseEvent): void
        if(count3 == 1 && stage.contains(pop3) )
           removeChild(pop3);
        if(count3 == 1)
         nextFrame();
        else
         addChild(pop3);
         pop3.x = 40;
         pop3.y = 120;
         count3 = 1;
    function backbtnscript1(event:MouseEvent):void
       if(stage.contains(pop1) )
          removeChild(pop1);
          backcounter = 1;
          trace("back" + backcounter);
          prevFrame();
    function unloadbtn1 (e:MouseEvent):void {
      removeChild(pop1);
    function backbtnscript2(event:MouseEvent):void
       if(stage.contains(pop2) )
          removeChild(pop2);
          backcounter2 = 1;
          trace("back" + backcounter2);
          prevFrame();
    function unloadbtn2 (e:MouseEvent):void {
      removeChild(pop2);
    function backbtnscript3(event:MouseEvent):void
       if(stage.contains(pop3) )
          removeChild(pop3);
          backcounter3 = 1;
          trace("back" + backcounter3);
          prevFrame();
    function unloadbtn3 (e:MouseEvent):void {
      removeChild(pop3);
    //SLIDE COUNTER
    and here is the Code on all the Frames where I need to call in specific Listeners
    FOR EXAMPLE ON FRAME 8,9,10,
    Here Is the Code ,
    FRAME 8
    stop();
    slidecounter.text = String(this.currentFrame - 1 + "/" + indexframe);
    count = 0;
    backcounter = 0;
    btn_nxt.addEventListener(MouseEvent.CLICK , fl_ClickToGoToNextFrame);
    btn_bck.addEventListener(MouseEvent.CLICK, backbtn);
    btn_bck.removeEventListener(MouseEvent.CLICK , backbtnscript1);
    btn_nxt.removeEventListener(MouseEvent.CLICK , nextframe9);
    pop1.closebtn.addEventListener(MouseEvent.CLICK, unloadbtn1);
    //btn_notice1.addEventListener(MouseEvent.CLICK , loadnotice1);
    FRAME 9
    stop();
    slidecounter.text = String(this.currentFrame - 1 + "/" + indexframe);
    //POPUP FUNCTION
    count = 0;
    btn_nxt.removeEventListener(MouseEvent.CLICK , fl_ClickToGoToNextFrame);
    btn_bck.removeEventListener(MouseEvent.CLICK, backbtn);
    btn_bck.addEventListener(MouseEvent.CLICK , backbtnscript1);
    btn_nxt.addEventListener(MouseEvent.CLICK , nextframe9);
    btn_notice1.addEventListener(MouseEvent.CLICK , loadnotice1);
    FRAME 10
    stop();
    slidecounter.text = String(this.currentFrame - 1 + "/" + indexframe);
    count = 0;
    backcounter = 0;
    btn_nxt.addEventListener(MouseEvent.CLICK , fl_ClickToGoToNextFrame);
    btn_bck.addEventListener(MouseEvent.CLICK, backbtn);
    btn_bck.removeEventListener(MouseEvent.CLICK , backbtnscript1);
    btn_nxt.removeEventListener(MouseEvent.CLICK , nextframe9);
    pop1.closebtn.addEventListener(MouseEvent.CLICK, unloadbtn1);
    I am repeating this Pattern on each frame set where I need these Listeners ,
    Problem is with the next one where I have two consecutive frames have different conditions to meet, any ideas how would I disable and enable listeners respectively on these frames ?
    I hope I am not confusing this very much ?;(

  • Removing All Event Listeners

    If you have multiple event listeners running, is there any way to remove all of them at once rather than one at a time?
    Thanks,
    Jeff

    Near the end of the article linked below is one approach that someone has used involving an array:
    http://www.almogdesign.net/blog/actionscript-3-event-listeners-tips-tricks/

  • Is there a way to clear ALL event listeners, stop all movie clips, etc?

    Is there a syntax for this?
    I have a movie that has 15 frames. Each frame has embedded movie clips within movie clips, tons of animations and event listeners. None is needed except when they are on the stage, on the frame. However, the animations continue even when the frame is left.
    For instance, I have a frame that has a dynamically rendered animation of leaves falling from a tree. When the frame is left, the leaves continue to fall.
    There are many instances of this type of thing happening.
    Ideally, I would love to just be able to clear everything when a new frame is loaded, since none of the animations or event listeners need to carry over from one frame to another.
    Is there a way to do this without the thousands of lines of code it would take to manually remove every single animation and event listener and sound, etc, from the stage?
    Thanks so much!!
    Amber

    you have to manually do that.
    or, you could convert each frame to a swf.  load each swf when needed and, if you're publishing for fp 10+, you can apply unloadAndStop() to kill all streams in the loaded swf and ready those assets for gc.

  • Buttons does not work if you leave button frame and return

    I have some simple buttons that work fine until i leave the frame the buttons are on a go to another frame. When i return the buttons are dead. This is how aI  set up listeners and handlers:
    //event listeners for tour screen buttons
    detailsMovieClip_mc.tour0.addEventListener(MouseEvent.CLICK, tour0_click);
    detailsMovieClip_mc.tour0.addEventListener(MouseEvent.ROLL_OVER, tour0_over);
    detailsMovieClip_mc.tour0.addEventListener(MouseEvent.ROLL_OUT, tour0_out);
    function tour0_click(Event:MouseEvent):void
    //do something
    function tour0_over(Event:MouseEvent):void
    //do something
    function tour0_out(Event:MouseEvent):void
    //do something
    any idea why this is happening?

    An object with its alpha property set to zero remains interactive regardless that you can't see it.  When I said to make them visible/invisible I meant set the buttons' visible property to true/false as needed.

  • Can't remove event listener from Image

    I'm clearly missing something and would appreciate some help.  I'm trying to run an event handler when an Image completes loading,  then remove the handler so that it won't  run again should the image be reloaded later.
    The problem that I'm having is that the event handler simply wont' go away, despite calling removeEventListener on the Image object.
    The following example demonstrates the problem (the example doesn't actually do anything useful...it's just the shortest example to demonstrate the problem).  (To run the  app, you'll have to provide any ol' JPEG file named "myImage.jpg" in the "src" directory of your project).
    What I expect to happen is :
         1) on startup, the image loads and loadComplete() runs.
         2)  loadComplete removes the event Listener so that subsequent re-loads won't re-fire the handler.  I only want the handler to  run once.
         3) "loadComplete" shoudl  be displayed in the Debug console.
         4) A button click should display only "Changing  Image" in the Debug console
    What I get instead is that the loadComplete handler isn't  removed, and every  time I click the button, loadComplete runs when the image is re-loaded   (i.e., every button click results in both "Change Image" AND "loadComplete"  being displayed in the Debug console).
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Image width="655" height="181" source="myImage.jpg" id="myImage" autoLoad="true" scaleContent="true" complete="loadComplete()" x="100" y="100"/>
        <mx:Button x="100" y="341" label="Button" click="click(event)"/>
        <mx:Script>
            <![CDATA[
                private function loadComplete():void
                    trace ("loadComplete");
                    myImage.removeEventListener("complete", loadComplete);
                private function click(evt:Event):void
                    trace ("Changing Image");
                    myImage.load("myImage.jpg");    //  Reload same image; it's just an example
            ]]>
        </mx:Script>
    </mx:Application>

    Hi,
    You can remove only event listeners that you added with the addEventListener() method in an ActionScript block. You cannot remove an event listener  that was defined in the MXML tag, even if it was registered using a call  to the addEventListener()method that was made inside a tag attribute.
    Check this page for reference.
    http://livedocs.adobe.com/flex/3/html/help.html?content=events_05.html
    You can modify the code a bit a get it working
    <mx:Image width="655" height="181" id="myImage" scaleContent="true"
              x="100" y="100"
              creationComplete="myImage_creationCompleteHandler(event)"/>
    private function myImage_creationCompleteHandler(event:FlexEvent):void
         myImage.addEventListener("complete",myImage_completeHandler);
         myImage.load("myImage.jpg");
    private function myImage_completeHandler(event:Event):void
         myImage.removeEventListener("complete",myImage_completeHandler);

  • Using Multiple Event Listeners

    Hi,
    I have a movielcip (A) class in which I have used a Tween class effect on a child movieclip (B) scrollRect. The (B) Movieclip in turn has several movieclips whose have tween class effect being executed on thier child movieclips.
    the tweens are all unique to each movieclip
    and the event listeners are taken off once completed.
    This works all well and good in FLASH IDE...
    My problem arises when I try to view this in a browser on a Windows XP
    it doesnt work in
    Opera Version 9.63
    Firefox 2.0
    and Google Chrome 2.0
    The only browser it works fluently in is
    Internet Explorer 7.0.5
    What is happening in most cases it that the animation appears to "stick" but i think what may be happening is the listening or removal of the event listeners. The animations are left incompleted.
    Is there any rule of thumb when using multiple event listeners?
    here is a snippet of some of my code
    on click event from movieclip (A)
    private function scrollToSlidePrev(e:MouseEvent) {
                   if (((slideIndex - 1) >= 0)) {
                        nextButton.mouseEnabled = nextButton.enabled = previousButton.enabled = previousButton.mouseEnabled = false;
                        var position:Number = 0-SLIDEAREA.width;
                        var slide1:TileListSlide = slides[slideIndex] as TileListSlide;
                        var slide2:TileListSlide = slides[--slideIndex] as TileListSlide;
                        scrollSlide(position,slide1,slide2);
    tween animation in movieclip (A) on (B)
    private function scrollSlide(pos:int,slide1:TileListSlide,slide2:TileListSlide) {
                   slide1.resizeSlideTo(0.6); // execute tween on child movie clips in B
                   slide2.resizeSlideTo(1); // same as above;
                   var rect:Rectangle = sliderMc.scrollRect;
                   var tween1:Tween = new Tween(rect,"x",Regular.easeOut,rect.x,rect.x + pos,3,true);
                   tween1.addEventListener(TweenEvent.MOTION_CHANGE,setSliderScroll,false,4);
                   tween1.addEventListener(TweenEvent.MOTION_FINISH,toggleButtonEnabled,false,3);
    tween animation in movieclip (B) children
    public function resizeSlideTo(sc) {
                   var m:Matrix = tileList.transform.matrix as Matrix;
                   var p:Point = new Point (m.a, 0);
                   var tween2:Tween = new Tween(p,"x",Regular.easeOut,p.x,sc,3,true);
                   if (numericStepper != null) {
                        if (sc != 1) {
                             numericStepper.visible = false;
                             tween2.removeEventListener(TweenEvent.MOTION_FINISH,showStepper);
                        if (sc === 1) {
                             tween2.addEventListener(TweenEvent.MOTION_FINISH,showStepper,false,2);
                   tween2.addEventListener(TweenEvent.MOTION_CHANGE,setScaleOnScroll,false,3);
    here is the link
    http://visual_admin.web.aplus.net/ticker/ticker_widget.html
    the effect disables and re-enables the buttons when its done.... then the listeners are removed.
    each one with the exception cretes its own unique tween (obviously this is a custom class built as each clip)
    i really don't know what to make of it guys         

    apparantly making the tween a property of the class rather than a random variable in a function worked.....go figure

  • [JS] Basic question about event listeners and event handlers

    I am very new to the whole topic of event listeners and event handlers.  I'd run the test for the following problem myself, but I don't know where to start, and I just want to know if it's impossible -- that is, if I'm misunderstanding what event listeners and event handlers do.
    Say I have an InDesign document with a text frame that is linked to an InCopy story.  Can I use an "afterImport" event listener on the text frame to perform some action any time the link to the InCopy story gets updated?  And will the event handler have access to both the story that is imported, and the pathname of the InCopy file?
    Thanks.

    Thank you, Kasyan.
    Both of those are good solutions.
    We are currently using InDesign CS4 and InCopy CS5.  I'm hoping to get them to purchase the whole CS5 suite soon, since I'd like to start writing scripts for InDesign CS5 as soon as possible, as long as I'm going to have to be doing it in the not too distant future anyway.  The greater variety of event handlers sounds like it might be something that is crucial to the project I'm working on, so that adds to the argument for getting CS5.
    Thanks again.  You have no idea how helpful this is.  I made some promises to my boss yesterday that I later realized were  based on assumptions of mine about the InDesign/InCopy system that didn't make any sense, and I was going  to have to retract my promises.  But after reading your response I think I can still deliver, in a slightly different way that I had been thinking before.
    Richard

  • Loading/Unloading a .swf that adds event listeners to the Stage

    Hi all,
    Disclaimer
    Apologies if I suck so bad at using forum search that the answer to this is on page 1 somewhere; I tried...
    Question
    I am loading and unloading a .swf to which I do not have source code access. This .swf places several event listeners on the stage, as far as I can tell. When the .swf is unloaded, the event listeners placed upon the stage still seem to be in effect. Using unloadAndStop doesn't seem to do it, and I have to target Flash Player 9, anyway, so can't really use it. Is there any other way I can keep this external .swf from holding onto my main movie's stage?
    Additional info
    All eventListeners and references being set by my code are removed.
    I've managed a little contact with the author of the .swf:
    I've requested he provide a dispose() method I can call to get all the listeners removed, and send an updated .swf.
    He's suggested that I should be able to avoid the problem by loading into a unique ApplicationDomain. I'm not terribly familiar with this, but have given it a try without much success. Is this a valid solution - can I really protect my 'stage' by properly using ApplicationDomains - or do I need to persist in trying to get a public dispose() method built in?
    Thanks in advance!
    Cheers, John

    thanks for reply sir
    sir actually, i have not any problem with loading any file but i need to go back to intro.swf file when i click on clsbtn of main.swf, i want unload the main.swf file and panel.swf file
    actually i did was, i have intro.swf file and there is button by clicking load main.swf file (where is timeline controling butons) and in the main file automatically load panel.swf file ( where is all animation)
    its all play gud , no problem
    but my problem is there is a clsbtn in main.swf file and when i click on that button everything should be unload and it should return on the previous position in intro.swf
    i hope u understand what i am trying to say

Maybe you are looking for

  • Implicit null and explicit null

    Hi, 1) If a router receives a label of 0,what is it supposed to do..? label poppoing or swapping th label with 0. 2) If a router receives the label of 3,whether it pops the label or swap the incoming label with the value of 3..? Thansk

  • Installed BT NetProtect Plus on a PC Being Upgrade...

    I have a PC running one of my BT NetProtect Plus licences.  The PC is currently running Windows XP Pro SP3, but in the near future it's going to get wiped and replaced with Windows 7 Ultimate.  The hardware is all staying the same just the Windows ve

  • Connecting Mac Pro with GeForce GT120 to monitor and TV at same time

    Hi - I just want to know in advance of buying the latest 8 core Mac Pro with a single NVIDIA GeForce GT120 graphics card, will this connect to both my apple cinema display 20'' and my Panasonic Viera LCD TV's 'PC Input' at the same time? From what I

  • Blackscreen cold start workaround and software conflict

    I, too, have the black-screen on cold-reboot problem, and resetting the PRAM is the best solution I have found, save this one: when I start, I always choose my startup disk by holding down the [option] key during reboot. This lets me choose the windo

  • Cannot Enter serial # for photoshop CS5.1

    I installed PS CS5.1 but when I went to open it it said the serial number was bad. I received the "FIX" So i then down opened PS and when the serial number screen came up I ran the fix, it said successful, but it still ot take my serail number/ When