View Full Version : Creating a movie clip instance?
Father_Chaos
02-25-2006, 01:26 AM
First of all, I'm new to Flash and the forums so hi everyone :D!
Okay, so I created a bullet movie clip, and I'm just wondering how could I make it so that when the user clicks anywhere on the screen with the mouse, it creates an instance of the bullet.
Thanks!
oldnewbie
02-25-2006, 01:35 AM
var count:Number = 0;
this.onMouseDown = function(){
count++;
bullet_mc.duplicateMovieClip("bullet"+count, count);
};
Father_Chaos
02-25-2006, 01:53 AM
It didn't work :(...
Shouldn't I use attachMovie?
oldnewbie
02-25-2006, 02:45 AM
var count:Number = 0;
this.onMouseDown = function(){
count++;
this.attachMovie("bullet_mc","bullet"+count, count);
this["bullet"+count]._x = this._xmouse;
this["bullet"+count]._y = this._ymouse;
};
Or, if you drag an instance of the clip off-stage, and give it the instance name of bullet_mc...
var count:Number = 0;
this.onMouseDown = function(){
count++;
bullet_mc.duplicateMovieClip("bullet"+count, count);
this["bullet"+count]._x = this._xmouse;
this["bullet"+count]._y = this._ymouse;
};
Father_Chaos
02-25-2006, 02:54 AM
Thanks a lot, it works now!
Oh yeah, and I live one hour northwest from Montreal, go Canada ;)!
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.