Can someone please explain this better?

hi,
i read this tutorial on dynamic event handlers on this site

i am still LOST as to how they work
if someone can explain this better to me (if thats possible)
i would really appreciate it

so go here and click on the dynamic event handler tute
http://www.kirupa.com/developer/actionscript/as_tricks.asp

things like :

onClipEvent (enterFrame)
{
if (this._x<300) this._x+=5;
}

make my head hurt - i WANT to understand this please help!!

thanks

From what I could understand:


onClipEvent (enterFrame){ // Every time flash starts a new frame
if (this._x<30) { // Check if the _x position of this is less than 30
 this._x+=5; // and if it is move the x position 5 more to the right
}
}


this._x += 5 is the same as saying

this._x = this._x + 5.

Flash enters a new frame depending on the frames per second you have set.

*Originally posted by pixel_fiend *
if someone can explain this better to me (if thats possible)
i would really appreciate it

Are you trying to say that I wasn’t clear?

No seriously, I tried to make it step by step. The only thing that is tricky here is the += thing, and I explained it in another AS trick… Unfortunately the order of the articles is not correct. Sorry about that.

pom :stuck_out_tongue:

Actually it’s not more than a week ago i figured out += and -= and so on…

It does actually save code + time…

p-fiend: Just fiddle around with it for a few days, it sinks in pretty quickly :stuck_out_tongue: