The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 ViewsOkay so this is probably very easy and I am just blanking on how to do it, but each time a certain button is clicked I want a sprite I have to play its short animation .
As2.0
Put:
stop();
On the first frame of the animation. Then, put this on the button
on(release)
{
nameOfClip.play();
}
where nameOfClip is the instance name of the clip you've created.
Perpetually looking for time to return to the arts.
That answered my question perfectly. Thank you.
...But now that I have it set up I am a little disappointed. I was hoping/expecting that each time I clicked the button it would play the sprite and if it was clicked rapidly that the little "+1" animation would overlap a bit, instead it seems to wait for the animation to stop before starting another one.
Try:
nameOfSprite.gotoAndPlay(1);
Which will reset to the first frame every time the button is clicked.
Perpetually looking for time to return to the arts.
Hmmm that is closer to what I want and if I have to I wouldn't be devastated staying with this, but I was hoping that it would play the animation each time it was clicked with overlapping. Did a quick crappy picture of what it would kinda look like.
That would require creating duplicates of the object. Something like this:
Main Timeline
counter = 0;
Button
on(release)
{
var clip = duplicateMovieClip("instanceName", "instanceName"+counter, counter);
clip.play();
counter++;
}
And on the last frame of the clip itself:
this.removeMovieClip();
Some of my syntax might be wrong. haven't worked with AS2.0 in quite some time.
Perpetually looking for time to return to the arts.
At 7/14/09 11:37 AM, Johnny wrote: That would require creating duplicates of the object. Something like this:
Main Timeline
counter = 0;
Button
on(release)
{
var clip = duplicateMovieClip("instanceName", "instanceName"+counter, counter);
clip.play();
counter++;
}
And on the last frame of the clip itself:
this.removeMovieClip();
Some of my syntax might be wrong. haven't worked with AS2.0 in quite some time.
Wouldn't he have to put something like _root.['instanceName"+counter]. play instead of clip.play
At 7/14/09 12:54 PM, MrNine wrote:
Wouldn't he have to put something like _root.['instanceName"+counter]. play instead of clip.play
Not if you create a local variable for it like I did...
By saying
var thingy = attachMovieClip() //or duplicate
You can access properties of that attached clip immediately by using 'thingy.'
Though, you try and access it outside of it's local function, or later down the line, you couldn't.
You could however do something like this later.
for(i = 0; i < 100; i++)
{
var thingy = _root["thing+i"]
thinggy.x = whatever.
}
To achieve the same thing.
Perpetually looking for time to return to the arts.