actionscript loops
- Started
- Last post
- 11 Responses
- rizingdamp
Ive been told that:
"[dont use]onClipEvents, it's deprecated code. in fact don't write any code directly to an MC"any tips on how to do da loop thing without the onenterframe thing?
- ivan_cook0
I'm not an expert, but I ususally use a "for" or "while" loop.
- iDp0
I believe you use listeners to tell others what to do once it's been triggered.
onEnterFrame continuously runs checking to see if something has happened where listeners are alerted once it does happen.
- rizingdamp0
thanks, you wouldnt have an example of either method would you
- imakedesign0
use setInterval.
- Stylus0
on the maintimeline:
myMovieClip.onEnterFrame=fucntio... (){
//insertCode here
}
is this what you mean or setInterval is good to but sometimes you want frame dependent shit so still use the onEnterFrame event
- rizingdamp0
setInterval seemed to work fine, nice to beable to set speed rather than rely on frame rate
- tGP0
people used to make habit of dragging a blank movie clip to the stage, and attaching actions to it, you can do something like this too, makes for clean code as it can all be centralized on the main timeline:
_root.createEmptyMovieClip("hold... 10);
holder_mc.onEnterFrame = function() {
if (something happens){
// do this...
} else {
// do that...
}
};
- rizingdamp0
thanks for all that help guys, i am trying to learn some new actionscript stuff on a personal project rather than using old tried and tested work arounds that have worked in the past so i will probally be hasseling you all with some more questions in the near future...
riz
- AMFA0
Use SetInterval....
make a function that handles all your dynamic movement and pass the MC path, new size, new x, y, etc. Then declare an interval in the in the function that does it for you.
that way you only have one function handling motion, etc. Makes it easier to find, modify, etc.
- abizzyman0
setInterval
done.
- imakedesign0
you can also use the mx transitions.