I should have created this a while back. Sometimes we just want to wild-up

some custom event to communicate a value to listeners. This is for that.

CommandEvents are close, but are all dispatched using a single 'type' value,
so a single handler must have a switch statement in it (unless you're
a controller, which has magic to call the right method.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4606 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2007-02-28 02:58:45 +00:00
parent a11b338156
commit d652de50e7
+35
View File
@@ -0,0 +1,35 @@
package com.threerings.util {
import flash.events.Event;
/**
* A handy event for simply dispatching a value associated with the event type.
*/
public class ValueEvent extends Event
{
/**
* Accessor: get the value.
*/
public function get value () :Object
{
return _value;
}
/**
* Construct the value event.
*/
public function ValueEvent (type :String, value :Object)
{
super(type);
_value = value;
}
override public function clone () :Event
{
return new ValueEvent(type, _value);
}
/** The value. */
protected var _value :Object;
}
}