-
Problems with gotoAndPlay
I have written Actionscript 3 to listen for keyboard events. For instance, if the user is on frame 2 of the timeline, and they press the right arrow key on the keyboard, they will gotoAndPlay (3). This works fine.
I have also programmed the left arrow key to go back frames. For instance, if they are on frame 2, and they press the left arrow, it will gotoAndPlay (1). This works OK, but here is the problem.
Once they go back to frame 1, if they press the right arrow key, it should go to frame 2. But, it doesn't. It picks up from frame 2 and jumps to frame 3.
Why?
-
Where did you put your code? Is it a separate listener on each of the 3 frames or just one listener that spans the 3 frames? Although it doesn't really matter for what I'm suggesting...
Try this
PHP Code:
stage.addEventListener (KeyboardEvent.KEY_DOWN, onStageKeyDown, false, 0, true); function onStageKeyDown (e:KeyboardEvent) { if (e.keyCode == Keyboard.LEFT) { this.prevFrame (); } else if (e.keyCode == Keyborad.RIGHT) { this.nextFrame (); } }
-
Have you tried gotoAndStop or nextFrame and prevFrame?
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|