-
I would like to have a movie clip called "line" choose a new x value every 2 seconds... is there any way to make it (every 2 seconds) generate a random #, make that an x value and replace the movie clip there?
Please help!
Thanks
Relcon
-
hmmm
i guess you would just write a script that would do the math 2 figure out a random number for the x coord. you could make the line an mc. (give an instance name)
place the actions inside of the mc using an 'onClipEvent' - EnterFrame (choose this so that it keeps repeating and getting a new coord number from the script)
does that make sense? i bet someone else could explain that better.
anyway. that's how i would do it.
-
could you type in an example?
could u add in an example of what the actionscript would look like?
Thanks
Relcon
-
I don't know the exact code but here's an idea.
Let's say your movie is running at 20 frames per second. Then in your mc set a variable for a counter.
var counter = 0
then put a conditional inside an enterframe onClipEvent.
so... onClipEvent (enterFrame) {
if (counter == 40) {
//your duplicating and randomness code here;
counter = 0;
}
else {
counter ++;
}
So theoretically every time the mc enters a frame it will increment the counter variable and in 2 seconds it will reach 40 and then execute the code inside your conditional.
I haven't done this but I think it can work.
I hope that helps you a little.
Dan
-
yeah
um...yeah...what that guy said.
hey Dan. you are obiviously a genius. can you please help me with the thread i just posted about preloading? it's a few down. i really need some help.
thanks
-
sweet idea
wow
now im happy
thanks a bunch man (my name is dan too, it was wierd when that guy called u a genius... i thought he meant me for a sec.!)
hehe
alright
thanks a bunch!!!
Relcon
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
|