A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: buttons not able to control a movieclip's timeline

  1. #1
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81

    Question buttons not able to control a movieclip's timeline

    i have 2 buttons (prev and next) that should control the timeline of a moviclip called "container"

    but it just doesn't work. at first it moves to the second frame on this movieclip then the container shows always the same content ( it has different content for each frame), the content of the second frame.

    though , the output panel shows:

    prev. cf: 2
    next. cf: 1

    Code:
    function btnContainerClick(e:MouseEvent):void
    {
        if (e.target.name == "btn_prev")
            trace ("prev. cf: " + container.currentFrame);
    //        container.gotoAndStop(container.currentFrame - 1);
              container.prevFrame();
    //        container.gotoAndStop(2);
    
        if (e.target.name == "btn_next")
            trace ("next. cf: " + container.currentFrame);
    //        container.gotoAndStop(container.currentFrame + 1);
              container.nextFrame();
    //        container.gotoAndStop(5);
    }
    i get absolutely no clue of what's going on and i'm getting insane.
    i really appreciate any help. thanks a lot.

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    If this doesn't help, please attach a source file, and we'll go from there, but until then, try the following:

    Code:
    function btnContainerClick(e:MouseEvent):void {
    	if (e.target.name=="btn_prev") {
    		trace("prev. cf: " + container.currentFrame);
    		container.prevFrame();
    	}
    	if (e.target.name=="btn_next") {
    		trace("next. cf: " + container.currentFrame);
    		container.nextFrame();
    	}     
    }
    It looks to me like your conditionals aren't properly formatted. Remember to keep all actions assigned to the particular condition within the condition to which they apply. Then the container.gotoAndStop(5);
    I wasn't sure when that was supposed to happen.

    Does this help?

  3. #3
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    EDIT: this post can be removed, misread your code
    Last edited by florianvanthuyn; 08-13-2009 at 05:13 PM. Reason: stupidhead me
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

Tags for this Thread

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