A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: getting multiple buttons to play the same animation.

  1. #1
    Member
    Join Date
    Jun 2003
    Location
    sunny SoCal
    Posts
    76

    getting multiple buttons to play the same animation.

    I have a popup text box that I have run it's animation every time a certain button is clicked....and that works. However, when a different button is clicked, that has the same function on it, it won't animate.....and the first button will no longer run it either. I have a trace on the function that shows it is still working, but the animation itself no longer plays.

    this part works, but only until a different button is pressed, then it no longer does.
    Code:
    this.popUpAnim_mc.gotoAndPlay("anim");
    
    this.hot_btn.addEventListener(MouseEvent.CLICK, popAnim);
    
    function popAnim(myevent:MouseEvent):void{
    	this.popUpAnim_mc.gotoAndPlay("anim");
    trace("popUp animated slide");
    }
    Here is one of the other buttons I want to also run the animation. It has another function as well, and I will include all of it's code, in case I'm overlooking something that's causing it to break.
    Code:
    Object(this).popUpAnim_mc.PopUp_mc.back_btn.addEventListener (MouseEvent.CLICK, backClick);
    function backClick (myevent:MouseEvent):void {
    	this.gotoAndStop(currentFrame-1);
    }
    //Hide Button on Frame 1
    Object(this).popUpAnim_mc.PopUp_mc.back_btn.visible=false;
    //constantly check current frame to determine if it should be hidden
    this.addEventListener (Event.ENTER_FRAME, BackButtonVis);
    function BackButtonVis (event:Event):void{
    if(this.currentFrame==1||(currentFrame==totalFrames)){
    	Object(this).popUpAnim_mc.PopUp_mc.back_btn.visible=false;
    }else{
    	Object(this).popUpAnim_mc.PopUp_mc.back_btn.visible=true;
    }
    }
    this.popUpAnim_mc.PopUp_mc.back_btn.addEventListener(MouseEvent.CLICK, popAnim);
    there are two other buttons that have different functions that I want to also run the animation...but if I can just get one to work, I'm hoping the other two will be easy.

    Thanks in advance!

  2. #2
    Member
    Join Date
    Jun 2003
    Location
    sunny SoCal
    Posts
    76
    Could it be because my main timeline is going backwards on all of the other buttons, and that somehow stops my popup animation from working? That's the only thing I can think of so far.... that it works as long as the main timeline is advancing, but once it's reversed, it doesn't work at all.....even when it is once again advancing. Any ideas how to solve this?

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