[Action Script 2] Playing a movie clip on mouse press
5 replies, posted
So I'm working on a simple game for my programming course and for some reason my movie clip isn't playing. I instanced the clip as "Gun" and here's my code.
[CODE]
onClipEvent (mouseDown)
{
Gun.play();
}
[/CODE]
The code is in a seperate movie clip that contains all of my other code but I think the code looks functional.
You have changed "<Instance Name>" to "Gun" (capital G), right, and not just had it instance off an MC in the librabry? (Click object -> Properties -> Change name.
Also, if that seperate movieclip isn't a parent object of run, you'll have to refer to root.
_root.Gun.play();
You can also place GUn inside of the "seperate movieclip" and use it without _root.
Worked with the _root in front, thanks alot!
For the record, if you're trying to play a movie clip that's inside a movie clip you'll have to set out the path.
(For example, _root.Gun.Bullet.play (); )
All right I'll remember that.
And say that you want to play Gun, you can also place "_parent.play();" within Bullet MC for the same effect as "_root.Gun.play();", because Gun is parent of Bullet :)
Sorry, you need to Log In to post a reply to this thread.