A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: AS2 key and mouse listeners

  1. #1

    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?

  2. #2
    Member
    Join Date
    Mar 2000
    Location
    Atlanta
    Posts
    83
    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

  3. #3

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center