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:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user