Menu

Filip Zawada

πŸ‘¨πŸ»β€πŸ’» iOS tinkerer

Fingers Released

Fingers logo

Fingers is a micro AS3 extension, which simplifies working with events. I’m working on it, but there is quite stable version, which you can:

Here are some basics (under construction):
[sourcecode language=”actionscript3″]
package com.filimanjaro.fingers
{
import flash.display.MovieClip;public class FingersExample
{
public function FingersExample()
{
// This is a sample use of Fingers.
// Fingers are micro AS3 extension for
// handling events, inspired on C#.
// —
// Enjoy,
// Filip Zawada (the author)

// We will use MovieClip, however you
// can use any IEventDispatcher you wish.
// Fingers uses native AS3 events – it’s just a wrapper.
var obj:MovieClip = new MovieClip();

// go to next frame, when user click obj.
// (listening for an event example)
on(obj).click = obj.nextFrame;

// Pure AS3 isn’t so friendly:
// obj.addEventListener(MouseEvent.CLICK, function ():void {
// obj.nextFrame();
// });

// add another listener
// (without removing previous one)
on(obj).click += function():void
{
obj.alpha = 0.5;
}

// dispatch an event!
on(obj).click();

// remove all obj click listeners (only those added with on)
on(obj).click = null;

// remove all obj listeners added (only those added with on)
on(obj).removeAllListeners();

// more docs soon…
//
// homepage: http://filimanjaro.com/fingers
// download: https://github.com/FilipZawada/Fingers
}
}
}
[/sourcecode]

Comments

kurguru says:

This looks cool! I’m currently using Robert Penner’s Signals, but your version looks shorter and clearer. Maybe it’s possible to combine both approaches (as I get it, the restriction is that objects must implement IEventDispatcher to use Fingers).

Filip Zawada says:

That’s definitely doable! I haven’t used Signals before (although heard great things about them) but should definitely try them. Also if you’re interested, feel free to fork the project on GitHub and push your changes. I’m eager to help πŸ™‚

Leave a Reply

Blue Captcha Image
Refresh

*