-
AS2 key and mouse listeners
Is it possible to have full control over key and mouse events inside classes, or do I need to add listeners in the fla file?
-
You can have all your controls in your classes. I have a "Character" class and it has all its controls inside but I do have to add the listener.
Example:
class Character{
public function onKeyDown():Void{
//handle keys
}
}
then:
import Character;
//new Character(mcName)
var hero:Character = new Character("char_main");
Key.addListener(hero);
This is from an early (and kind of poor) tile-based engine I am working on in AS2 so I am sure there are better ways.
brad
-
thak you
Thank you. That's what I was looking for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|