PDA

View Full Version : onEnterFrame VS Key.addListener question


dizarter
02-24-2008, 08:10 PM
Hi everybody,

i'm glad i finally joined this board.

Hope someone can help me with this one:

is it better to check which keyboard button was pressed within
onClipEvent(enterFrame) or it's better to add listeners for the keys?

Also, i presume that listeners are frame independent...

If that's the case, does that mean that with listener
i can also catch those events which happened
between two frames?

Thanx,

and if anyone has questions, let me know
i'll see if my mid-level AS knowledge can help.

ASWC
02-24-2008, 08:14 PM
Key.addListener are better than onEnterFrame checking, they require a tiny bit more knowledge to work with since you sometimes might have to remove the listener and add it agian on some cases (like loading external swfs). Anyway that's the best way to go, without mentioning that onEnterFrame is ressource comsuming.

scarce
02-25-2008, 12:12 AM
also just to note, (and I thinbk many people will agree with me) it works best to put all of your coding on the timeline instead of each object. In the long run it'll make it easier to have each mc "talk" to each other, or change variables without using global functions or what not...I have a couple games I started where I use all the coding on the timeline and I have one game I've been working on for awhile where I have majority of the coding in the timeline, but also in the time lines of some loaded mc's.