dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Frame advancment question

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    5

    Frame advancment question

    My question is what action scripting needs to be done to create a button two buttons to advance and back track a slide show. Because when I use the next frame or previous frame action scripts I always get
    **Error** Scene=Scene 1, layer=controls, frame=21:Line 1: Statement must appear within on handler
    nextFrame();

    I'm new to all of this so if anyone could explain what handler I need I would appreciate it.


    Thanks
    Mattt in Alfred Ny

  2. #2
    Senior Member
    Join Date
    Jun 2003
    Location
    Kent, WA
    Posts
    536
    Buttons need a handler so it knows when to call the code. Try this:

    code:

    on (release) {
    nextFrame();
    }


  3. #3
    Member
    Join Date
    Aug 2003
    Location
    Dryden, ON - Canada
    Posts
    71
    I haven't used nextFrame(); or the other, but perhaps setup a function like so:

    function Advance() { nextFrame(); }

    for both the nextFrame() and the other call on the global level, then on your button call the function?

    Just a thought, I haven't done any work with them. Nor have I checked the Macromedia specification for the functions.

    Hope this helps,
    Tyouk

  4. #4
    Junior Member
    Join Date
    Aug 2002
    Posts
    5
    Thanks alot I don't know why I couldn't figure that one out on my own.

  5. #5
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Make a new movie clip. Put a stop in frame 1. Add a frame label named firstPic. Add one image to each frame. In the last frame, add a frame label, lastPic. Drag the movie clip to the stage and give it an instance name: slideShow.

    On the back button:

    Code:
    on (release) {
    	with (slideShow) {
    		if (_currentframe == 1) {
    			gotoAndStop ("lastPic");
    		} else {
    			prevFrame ();
    		}
    	}
    }
    On the forward button:

    Code:
    on (release) {
    	with (slideShow) {
    		if (_currentframe == 22) { //means you have 22 pictures, change the number to what you actually have
    			gotoAndStop ("firstPic");
    		} else {
    			nextFrame ();
    		}
    	}
    }
    Now when the movie plays, you can click the back btton and jump to the last picture, when it gets to the last picture, it just wraps around back to the first picture, no dead end.

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