-
Little help for a newbie
Hello everybody!
I need to load 100 instances of the same clip, everyone in a random position.
This script does not seem to work:
Code:
import flash.display.MovieClip;
var droplet: drop = new drop();
for (var n: int = 0; n < 100; n++) {
droplet.name = "droplet" + n
addChild(droplet);
droplet.x = Math.random() * stage.stageWidth;
droplet.y = Math.random() * stage.stageHeight;
}
Could anyone kindly suggest me the right way?
Thanks!
-
ok i managed to make it work with an array:
droplet[i] = new drop();
droplet[i].x = Math.random() * stage.stageWidth;
droplet[i].y = Math.random() * stage.stageHeight;
addChild(droplet[i]);
now, i need to removeChild after droplet clip played.
a removechild within the clip itself seems to dont work.
Thanks!
-
Senior Member
Do you have a class for your MovieClip or simply frame to frame animation?
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by cancerinform
Do you have a class for your MovieClip or simply frame to frame animation?
im afraid the second
-
Senior Member
In the last frame of your MovieClip place these two lines:
stop();
this.parent.removeChild(this);
This will remove the MovieClip after the animation.
- The right of the People to create Flash movies shall not be infringed. -
-
hey thanks so much. it works indeed, but i got an error in the output window.
"TypeError: Error #1009: Impossibile accedere a una proprietÃ* o a un metodo di un riferimento oggetto null."
it is in italian, but basically it means "impossible to read a property or a reference method for a null object"
do you know what it could be?
thanks a lot!!!!!!!
-
Senior Member
this.parent must be the timeline to remove the movieclip. If the animation is inside of another movieclip, it would not work. Also the stop() is very important. You can try to create one more frame, where you put the stop(); and in the frame before place this.parent.removeChild(this); if this.parent is the timeline.
- The right of the People to create Flash movies shall not be infringed. -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|