Random Motion

There’s a problem of scope of variables when you declare prototypes and functions. I tried to explain it there :\rwww.kirupa.com/developer/…pring2.asp\rBut I didn’t try to make it work… Tell us if you have troubles.\r\rpom 0]

Hey Ilyas,
Thanx for the reply.
I checked your post. It cleared atleast one particular confusion… i had always wondered why it was necessary to write “this._x” when u could get the same result with a plain “_x”. but there is another file i am stuck with right now. Have u checked the new Flash Math Creativity book?.. pretty awesome stuff on it. So here is another question. In my MX actionscript reference, it says that the ‘prototype’ command was only adopted in the flash 6 player… then how come all the code on this book , which apparently has been written in flash 5, has the prototype keyword in it?..
secondly, if u check the code for the files on the book…
www.friendsofed.com/fmc/downloads
i was trying to make the first file by jamie mcdonald, titled towardUs to work in flash MX… this one also has the prototype declaration in it, and it still doesnt work…
can u tell me what the problem is?
Thanx Again.

I’ll check that. But they said on the forum that it was a problem of ** this.**…

pom 0]

Prototypes exist in F5

i’ve changed the code to work in mx.

like ily was saying, mostly just putting “this” in front of everything.

Could you please post the code as you modified it for MX? Thanks.

he did. Its the 4th post in this thread. Go back to the first page and go down to the 4th post. Its the one that says that it was edited 5-7-02

Thanks.

i cant get this to work, i am still new to more advanced aspects of actionscripting i make my object to move randoly convert to movie clip, insert button but i cant find anywhere to put the actionscript for the goto command, please help.

on the button.

no still not working. right here is what im doing. following the tutorial adding the actionscript, drawing a circle convert that to movieclip then converting that to button, so now i have a movieclip and button in the library. trying to add script to the button when it is selected is impossable as there is no actions in the drop down menu. ( if that make sence) when and where do i add my on mouse event goto stuff. what the hell am i doing wrong? it is probably so mind mumbingly simple to you lot. but it is pissing me off.

That’s a tough tutorial, maybe the toughest (???) on this site… Did you try and look at the source ? aybe you can compare.

pom 0]

if i’m understanding correctly, you’ll want to have a button within a movieclip, not a movieclip within a button.

is that how you have it now?

then the button actions can go on the button in the movieclip, and onClipEvent actions can go on the movies, and everything else can go in frame 1 of _root.

if you’re using mx, you can do something like this on the movies:

 
onClipEvent(load){
&nbsp &nbsp &nbsp &nbsp this.onRelease = function(){ trace("released!"); };
}

and do away with your buttons altogether.

what i have been told is that i need a button inside a movieclip. make the movie clip then convert that to button ( is that right?). then add script the button. i am using flash 5 for this but i also have mx.

i need a tutorial cos i have had no real time to sit down and learn actionscrript being at uni and all. anyone know any books that are essential reading i already have foundation flash (FOED) which i havent read yet.

almost right, make the button, and convert it to a movieclip.

thanks everyone, you’ve been a great help.

I’ve got several different objects that scroll downwards but they all group together on the same y level and tend to clump together on the x. Is there a way to spread them out completely, in random order (I’ve got 7 different, looping objects)

Here’s what I’ve been using:
onClipEvent (load) {
function reset () {
this._x = random(300);
this._y = random-(200);
loopSpeed = 6;
}
reset();
}
onClipEvent (enterFrame) {
if (_root.dragon.scrollStart){
this._y+=loopSpeed;
} else {
this._y+=loopSpeed;
}
if (this._y>575) {
reset();
}
}

Any help would be appreciated!
Tx
§

Never mind, I used a variant of the answer in the "Suprabeener: A quick Q: " post. Thank you! :slight_smile:
§