HXS 1.1 released - complete Flash event mapping

55 views
Skip to first unread message

Tony Polinelli

unread,
Mar 24, 2012, 7:01:19 AM3/24/12
to haxe...@googlegroups.com

Hi, 

So a little excited, i've added mappings for ALL of the AVM2 events - that i know of. based on the as3signals style (with my own twist).  This allows you to access all of the built in flash events very easily. 

and you'll see all the events - the best part of this is, now with using, you can do:

using hxs.Shortcuts; 

var mc = new MovieClip()
mc.events().click.add(function(e) { ... } ) 

there is completion for the list of events.. and ALL of the events (for all objects) are completed eg:

var loader = new URLLoader();
loader.events().complete... 

the only thing i find annoying, is not being able to have using 'on' by default as a compiler flag. With this in mind- so use the events without using, you can do:

public var events:InteractiveObjectEvents;

events = new InteractiveObjectEvents; 

or 

events = hxs.Shortcuts.get(this);  // i'll have to add this - just though of it then. 

then the events are available all the time - eg, if you were writing a UI library. The Events packages can be extended too. Or you can just add your own signals as before.


I thought of having the shortcut as a variety of names:

mc.events().click.add(...)

mc.getEvents().click.add(...)

mc.evt().click.add(...)

mc.on().click.add(...)

but settled on the 'events' so far, feedback invited.

Ideas - I'd like to have 'events' on ALL objects all of the time (which dispatch events) - to make the system seemless, and not a chore to remember to use. 

Options:

- extend all classes and add the member
- have 'using' on ALWAYS - compiler command? another option?
- have 'using' propegate, 
- macros?

enjoy!


--
Tony Polinelli
http://touchmypixel.com

Philippe Elsass

unread,
Mar 24, 2012, 8:18:25 AM3/24/12
to haxe...@googlegroups.com

This is a case I think where having events declared in metas plus macros would do wonders.

Tony Polinelli

unread,
Mar 24, 2012, 9:54:36 AM3/24/12
to haxe...@googlegroups.com

Definitely, macros could have reduced the grunt of writing up the definitions... greatly ;|
Reply all
Reply to author
Forward
0 new messages