-
1. Re: Movie clips
newToAS3 Jul 29, 2010 8:49 AM (in response to Smitch1581)I don't know/understand how you're animating your movieClips you got from InDesign.
If you're using timeline animation, one thing you could do is write some code in the last frame (end of the animation) of each one of your movieClips.
Something like this:
parent.gotoAndStop(2); //tells the current movieClip parent (in your case //the timeline, to gotoAndStop(2).
There are other things you could do but this is the easiest one that I can think of for now.
Other solutions would depend on your file structure. You could, for example, dispatch a new event from the end of each one of your movieClips and listen for this event on your main timeline and then gotoAndStop(someFrame);
If all your animations are very similar in time, you could try a timer (I hate this idea hehe).
Well, let me know if the first one works.
-
2. Re: Movie clips
Smitch1581 Jul 29, 2010 1:56 PM (in response to newToAS3)Hi newToAS3,
Thankyou very much for your reply, sorry if i'm being dumb but i am really NewToAS3!
I tried copying the text into the last key frame of the movie clip and i got the following error message
Call to display undefined method gotoAndStop through a reference with static type flash.display:DisplayObjectContainer. I then google that and there was a similar thread. Got the code as follows:
stop();
var p:MovieClip = parent as MovieClip;
p.gotoAndStop(2);
That seemed to work but have no real idea how! The thread said something about casting
"You need to cast parent to a MovieClip, like this:
var p:MovieClip = parent as MovieClip;
because parent is typed as DisplayObjectContainer"I kind of get it but dont truly understand casting and the "parent as MovieClip;" command :-)
Thankyou for your help tho, you have helped me get the answer
Cheers :-)
-
3. Re: Movie clips
newToAS3 Jul 29, 2010 2:20 PM (in response to Smitch1581)Yep.
Flash "think" you can't gotoAndStop on your parent's movieClip. You would probably get almost the same error if you try to use gotoAndStop in a textField or a Sprite for example. Flash will tell you: are you going nuts?! this is not a movieClip that you can gotoAndStop, this is a text field dude!
Indeed, but in your case, we know that your parent has frames and that you can "walk" within the frames of your "Stage" object using gotoAndStop. Unfortunately, flash seems not to be smart enough to know that (at least I think). So you "cast" your paren't object as a MovieClip that flash knows that you can gotoAndStop inside movieClips.
You're basically saying: Hey, listen Flash, my dear, I know that the parent of this object has a timeline full of frames and that I can "gotoAndStop". Now, consider it a MovieClip and stop(); bothering me... Thanks!
btw, I haven't tried that but instead of using a new var to "hold" your movieClip's parent, you could simply use
MovieClip(parent).gotoAndStop(2);
This should work too, but I'm not really sure about that.
Anyway, I'm happy you got your problem solved!
-
4. Re: Movie clips
Smitch1581 Jul 29, 2010 3:14 PM (in response to newToAS3)I see, thats great and your example worked too and i now understand how that works! Your down to earth analogy was spot on! The jargon i've read in books sometimes baffles me!
Thank you very much for your help, its greatly appreciated :-)
-


