Flash: Stop motion blocks gotoAndPlay

In summary, the bug is that gotoAndPlay does not actually go to the required frame, it goes through all frames and only after that will the play head go to that frame. This only happens when images are used, when flash drawings are used, it will works just fine.
  • #1
mtanti
172
0
I think I found a bug in Flash. It spans from CS3 to MX and perhaps earlier.

I did a stop motion animation of me turning the pages of a scrap book (frames of a video recording). Then I put labels on each frame where a page is completely turned and did some actionscript (gotoAndPlay) so that I can choose from which page to start and to which page to arrive.

The problem is that gotoAndPlay does not actually go to the required frame. Instead it goes through all frames and only after that will the play head go to that frame. This only happens when images are used, when flash drawings are used, it will works just fine. And the weird thing is that when only the first half of the key frames between labeled frames are used, it works just fine.

Here's the fla file (flash 08): http://rapidshare.com/files/141420616/scrapbook.fla.html

Here's how it works:
Layer 'code' contains actionscript and labels, layer 'animation' contains the stop motion pictures.
First frame of layer 'code' contains 2 variable initializations. currState holds the current page of the scrapbook and nextState holds the destination page (both zero based). There are 3 pages in all. A switch statement makes a gotoAndPlay to the required frame depending on currState (this is the part which doesn't work).
After the play head is on the frame with the start page, each labeled frame will contain actionscript to check if nextState matches the page on that frame and execute stop() if so.

I hope this is enough information to help you. If you need anything else just ask.
 
Last edited by a moderator:
Technology news on Phys.org
  • #2
This behavior is not exactly a bug, it happens because when the code in your first frame gets executed the remaining frames (which contain large images) haven't yet loaded. What ends up happening is that, your gotoAndPlay call will fail (flash hasn't yet loaded the named frame) and movie will continue to play. The movie continues to play because that's the default behavior - when the movie starts it will play unless you have a stop() action in the first frame - and also because gotoAndPlay calls play().

You can fix this first by putting a stop action in your first frame and then moving your switch statement into the onEnterFrame event which gets executed a few times a second. Inside that event you'd check to see if the movie has finished loading and only then let control go to the switch statement. Try putting the following code in the first frame:
Code:
stop();
currState = 2;
nextState = 2;
_root.onEnterFrame = function(){
	if(_root.getBytesLoaded() >= _root.getBytesTotal()){
		switch (_root.currState) {
			case 0: gotoAndPlay("closed"); break;
			case 1: gotoAndPlay("page1"); break;
			case 2: gotoAndPlay("page2"); break;
			case 3: gotoAndPlay("page3"); break;
			default:
				throw "error";
		}
		_root.onEnterFrame = null;
	}
}
 
  • #3
!
It works! Now why would that happen if I'm not using simulate download?

Thanks sooooo much! I've posted this on 4 foraa and this is the only one I got an answer from... PF rulez!
 

1. What is "Flash: Stop motion blocks gotoAndPlay"?

"Flash: Stop motion blocks gotoAndPlay" is a feature in Adobe Flash that allows for the creation of stop motion animations by setting keyframes and playing them in sequence. It is commonly used in creating short animations and is a popular tool among animators and designers.

2. How does "Flash: Stop motion blocks gotoAndPlay" work?

The feature works by allowing users to create individual frames of an animation and then play them in sequence at a set speed. This creates the illusion of movement and is the basis for traditional animation techniques.

3. Can I use "Flash: Stop motion blocks gotoAndPlay" for all types of animations?

While "Flash: Stop motion blocks gotoAndPlay" is a popular tool for creating short animations, it may not be suitable for all types of animations. It is best used for simple animations, such as bouncing balls or basic character movements. For more complex animations, other tools or techniques may be more suitable.

4. Is "Flash: Stop motion blocks gotoAndPlay" easy to use?

While the feature may seem daunting at first, it can be relatively easy to use with a bit of practice. There are many tutorials and resources available online to help users learn how to use the feature effectively. Additionally, the more you use it, the more comfortable you will become with the process.

5. Can I use "Flash: Stop motion blocks gotoAndPlay" in other Adobe programs?

While "Flash: Stop motion blocks gotoAndPlay" is a feature specific to Adobe Flash, similar techniques can be used in other Adobe programs such as After Effects or Animate. However, the process and tools may vary slightly between programs.

Similar threads

  • Programming and Computer Science
Replies
1
Views
3K
Replies
2
Views
3K
  • Sci-Fi Writing and World Building
Replies
11
Views
2K
  • Special and General Relativity
6
Replies
184
Views
19K
  • Introductory Physics Homework Help
Replies
1
Views
2K
  • Other Physics Topics
Replies
0
Views
682
  • Special and General Relativity
Replies
1
Views
2K
Back
Top