Problem: Movie Clip contains just one frame
Posted
by Doug
on Stack Overflow
See other posts from Stack Overflow
or by Doug
Published on 2010-03-24T19:27:31Z
Indexed on
2010/03/24
19:33 UTC
Read the original article
Hit count: 230
I'm a newbie at Flash, so started playing with a pretty standard code sample: one layer contains a movie clip with a flying rectangle, another layer has a button to control it. All script code is in Main.as file. The rectangle was named square1 through the Property window.
Here is the problem: the constructor for Main has a line: square1.stop(); to prevent clip from playing, but it doesn't help - it plays. I know the constructor fires, because it has trace("stuff") in it. The code does check that the stage has been created.
What strange is that square1.currentFrame always returns 1, and square1.totalFrames returns 1 as well. The layer has 24 frames on the timeline. I tried a tween with just 2 keyframes, then converted whole tween into frames - same result. I mean, the thing is flying before my eyes, how can it be 1 frame???
I even added a listener: square1.addEventListener(Event.ENTER_FRAME, onFrameChange); The event fires all the time, i.e. the frames change, but currentFrame is still 1.
Also, tried to name individual frames and use square1.gotoAndStop("begin") and stuff like that. Nothing helps. I am really stuck with this stupid problem.
© Stack Overflow or respective owner