flash random Q
- Started
- Last post
- 14 Responses
- unknown
if I have a MC which is basically some type that 'flashes on and off over 5 or 6 frames, how do I make it appear on the stage at random intervals/co-ordinates and size?
the idiot thanks you :)
- unfittoprint0
random time (within 10 seconds):
randTime=Math.round()*10000
random size (within 300%):
randSize=Math.round()*300
mc._yscale=mc._xcale=randSize
random position (within stage size)
randX=Math.round()*_root._width
randY=Math.round()*_root._height
now you just have to use setInterval and clearInterval to set a timer at random intervals and send the random parameters to your mc...
- unknown0
unfittoprint you're like some kind of flash oracle!!
Now have some patience with the muppet, can you please be a bit more specific - I'm just getting into this AS malarkey
much appreciated :)
- ********0
yeah he is! 'Flash Guru' this guys should be an admin for sure!
- unfittoprint0
much appreciated.
inside your mc...
function randomTimer(){
randTime=Math.round()*100
00;
return randTime
}function changeMC(){
randSize=Math.round()*300;
_yscale=_xcale=rand
Size
_x=Math.round()*_root.
_width;
_y=Math.round()*_root.
_height;
clearInterval(displayTime)
displayTime = setInterval(reset, randomTime);
}cross your fingers....
- unfittoprint0
damn. where you read
displayTime = setInterval(reset, randomTime);
you should read
displayTime = setInterval(changeMC, randomTime);
- unknown0
mmm not working, the MC is just flashing away in its normal position ?
I'm doing something wrong
- unfittoprint0
randomize dat mutha!
//evaluates random time within 2 seconds (2000 milliseconds)
function randomTimer() {
randTime = Math.ceil(Math.random()*2000);
return randTime;
}
function changeMC() {
randSize = Math.random()*300;
_yscale = _xscale=randSize;
_x = Math.random()*_root._width;
_y = Math.random()*_root._height;
clearInterval(displayTime);
randomTimer();
trace(randTime)
updateAfterEvent()
displayTime = setInterval(changeMC, randTime);
}
changeMC();
stop();copy paste within your mc action's frame. if it doesn't work i'll email u an fla.
- unknown0
YEEHAA! ok its working.. almost heheh
Can I get the MC to actually play? The MC has say 5 frames with its content flashing on and off, at the moment the MC is just showing the first frame and appearing at random size / position.. but I'd like it to play the flashing.
Thanks again for your time :)
- jg_20
unfittoprint is just amazing
APPLAUSEx1000
- unknown0
Ignore that last post - I have it working like a dream - thanks so much to you unfit - I owe you one!! :)
- stewart0
and
_yscale=_xcale=randSize
=
_yscale=_xscale=randSize
- unknown0
oh dear, here I go again..
this is strange, everything works fine when opened in the flash player but when I view in the browser all of a sudden this other movie clip on the stage starts to become affected in the same way.
Something to do with targetting? Its as if the whole stage is being affected or something.. hmm
thanks
- oculasm0
sweet code unfit :)
- Jnr_Madison0
unfittoprint for president