View Full Version : new information when enterFrame?
cardin
01-09-2003, 10:47 AM
Does the information inside the object actions get erased when the clip event enterFrame is used, or will the information stay?
Example:
onClipEvent(enterFrame){
posX++;
}
=================================
Will posX be 5 after the fifth run of this code, or will it be reseted to 1 (cause posX is 0, and posX++, if it was reseted)?
farafiro
01-09-2003, 11:04 AM
can u explain more??
also use trace to see how it worksonClipEvent(enterFrame){
posX++;
//**********
trace(pozX)
}
Mortimer Jazz
01-09-2003, 01:17 PM
It will continue to increment, as you can see by using 'trace' like Farafiro suggested).
It would only get reset if you also explicitly initialised the variable within the onEnterFrame.
If you declare: myVarName++, and this is the very first reference to "myVarName" then Flash is intelligent enough to create the variable and give it a value of 0. However, what you should really be doing is explicitly initialising your variables first - within the clip's load event would be a good place. Here's an example:
onClipEvent(load){
posX = 0;
trace("posX has been initialised");
}
onClipEvent(enterFrame){
posX++;
trace("PosX now equals: " + posX);
}
boyzdynasty
01-09-2003, 03:41 PM
just wanted to add...that...
enterFrame makes the player loop back over and over to that section of the code.... so posX will keep incrementing by one.
farafiro
01-12-2003, 08:51 AM
Also an addition to Boyz
the onEnterFrame executes the action with the FPS of your movie
i.e, if u r on 12fps, it will be 12 times per second
change it to 2fps, do a trace and see the result
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.