Hi,

Class names should begin with an Uppercase letter. RemoteClick not 
remoteClick.
The type String can be lowercase if you want..

Something like the following..

package modulecode
   {
        import flash.events.Event;

        public static const remoteClick:String="remoteClick";

        public class RemoteClick extends Event
        {
                public function RemoteClick(type:String="remoteClick",
                                                         bubbles:Boolean=false,
 
cancelable:Boolean=false)
                {
                        super(type, bubbles, cancelable);
                }       
        }
  }


//Some component that dispatches and handles RemoteClick events
<MyCanvas>

<script>
public function handleButtonClick():void{
  var eventObj:RemoteClick = new RemoteClick(); //no bubble
  dispatchEvent(eventObj);
}

public function handleRemoteClickEvent(e:RemoteClick):void{
    trace("handleRemoteClick: "+e);
}

public function init():void{
  addEventListener("remoteClick", handleRemoteClickEvent);
}
</script>

  <mx:FormItem label="" textAlign="right">
      <mx:Button label="Run" click="handleButtonClick()"   id="run"/>
  </mx:FormItem>

</MyCanvas>


Or....


//Some component that dispatches RemoteClick events. NOTE : the name of 
the event and the type.
<MyCanvas2>

<mx:Metadata>
         [Event(name="remoteClick", type="modulecode.RemoteClick")]
</mx:Metadata>

<script>
public function handleButtonClick():void{
  var eventObj:RemoteClick = new RemoteClick(); //no bubble
  dispatchEvent(eventObj);
}
</script>

  <mx:FormItem label="" textAlign="right">
      <mx:Button label="Run" click="handleButtonClick()"   id="run"/>
  </mx:FormItem>

</MyCanvas2>


Use MyCanvas2 in another component..

<ACanvas>
   <script>
     function handleRemoteClick(e:RemoteClick):void{ ... }
   </script>

   <MyCanvas2 remoteClick="handleRemoteClick(event)" ... />
</ACanvas>


HTH.
  - shaun

Reply via email to