From: DIY_Lobotomy on
I have a movieclip that is basically like a quick firework burst that fades
out. I'd like to use actionscript to continuously randomly place instances of
this movieclip at random locations on the stage. I'd like to have a variable
that can control the number of "bursts" that are allowable on the stage at
once...

...is this possible? Thanks!



From: ufitzi on
check the help for the following:
attachMovie()
createEmptyMovieClip()
movie clip linkage
exporting for action script
MATH.random()

Happy hunting!
bh



From: DIY_Lobotomy on
Let me apologize in advance for not being more specific. I should've mentioned
that I actually have been messing with stuff on my own, but am just stuck. As
a "start", here's what I've tried, but for some reason the MC's just keep being
places on top of each other at (0,0):



for(i=1;i<11;i++){
var xSpot:Number = (Math.floor(Math.random() * 650));
var ySpot:Number = (Math.floor(Math.random() * 95));
_root.attachMovie("burst1_mc", "burst"+i, getNextHighestDepth());
_root.burst[i]._x = xSpot;
_root.burst[i]._y = ySpot;
}

From: ufitzi on
Try this attachMovie line

_root.attachMovie("burst1_mc", "burst"+i,
_root.getNextHighestDepth(),{_x:xSpot,_y:ySpot});

That should fix the _level issue, while the x,y initialization is "tighter."
You know you're dealing with that specific instance when you pass the values
directly to attachMovie, instead of referencing them through another variable.

Hope this helps,
bh



 | 
Pages: 1
Prev: Controlling Sound
Next: play movie once