Avoid calling the type constant for an event with only one type TYPE.

Follow actionscript convention and create a reasonable name for it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4919 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2008-01-08 01:35:01 +00:00
parent a5b132757b
commit 460d826d91
4 changed files with 14 additions and 7 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ import flash.events.IEventDispatcher;
public class CommandEvent extends Event public class CommandEvent extends Event
{ {
/** The event type for all controller events. */ /** The event type for all controller events. */
public static const TYPE :String = "commandEvt"; public static const COMMAND :String = "commandEvt";
/** /**
* Use this method to dispatch CommandEvents. * Use this method to dispatch CommandEvents.
@@ -98,7 +98,7 @@ public class CommandEvent extends Event
*/ */
public function CommandEvent (command :String, arg :Object) public function CommandEvent (command :String, arg :Object)
{ {
super(TYPE, true, true); super(COMMAND, true, true);
if (_blockConstructor) { if (_blockConstructor) {
throw new IllegalOperationError(); throw new IllegalOperationError();
} }
+7
View File
@@ -27,6 +27,13 @@ import flash.events.EventDispatcher;
import flash.net.SharedObject; import flash.net.SharedObject;
import flash.net.SharedObjectFlushStatus; import flash.net.SharedObjectFlushStatus;
/**
* Dispatched when this Config object has a value set on it.
*
* @eventType com.threerings.util.ConfigValueSetEvent.CONFIG_VALUE_SET
*/
[Event(name="ConfigValSet", type="com.threerings.util.ConfigValueSetEvent")]
public class Config extends EventDispatcher public class Config extends EventDispatcher
{ {
/** /**
@@ -24,12 +24,12 @@ package com.threerings.util {
import flash.events.Event; import flash.events.Event;
/** /**
* Dispatched whenever a config value is changed. * Dispatched whenever a Config value is changed.
*/ */
public class ConfigValueSetEvent extends Event public class ConfigValueSetEvent extends Event
{ {
/** The type of a ConfigValueSetEvent. */ /** The type of a ConfigValueSetEvent. */
public static const TYPE :String = "ConfigValSet"; public static const CONFIG_VALUE_SET :String = "ConfigValSet";
/** The name of the config value set. */ /** The name of the config value set. */
public var name :String; public var name :String;
@@ -41,7 +41,7 @@ public class ConfigValueSetEvent extends Event
*/ */
public function ConfigValueSetEvent (name :String, value :Object) public function ConfigValueSetEvent (name :String, value :Object)
{ {
super(TYPE); super(CONFIG_VALUE_SET);
this.name = name; this.name = name;
this.value = value; this.value = value;
+2 -2
View File
@@ -32,12 +32,12 @@ public class Controller
{ {
if (_controlledPanel != null) { if (_controlledPanel != null) {
_controlledPanel.removeEventListener( _controlledPanel.removeEventListener(
CommandEvent.TYPE, handleCommandEvent); CommandEvent.COMMAND, handleCommandEvent);
} }
_controlledPanel = panel; _controlledPanel = panel;
if (_controlledPanel != null) { if (_controlledPanel != null) {
_controlledPanel.addEventListener( _controlledPanel.addEventListener(
CommandEvent.TYPE, handleCommandEvent); CommandEvent.COMMAND, handleCommandEvent);
} }
} }