Hi,
We can dispatch custom event with some values. The following steps we can send the values when dispatch the event. The Custom Dispatch Event class is created as follows
package service
{
import flash.events.Event;
import flash.net.FileReference;
public class UploadEvent extends Event
{
private var _data:Array;
public function get data():Array
{
return _data;
}
public function set data(val:Array):void
{
if(_data != val)
_data = val;
}
public static const UPLOAD_FILE_COMPLETD:String = "UploadFileSelected";
public function UploadEvent(type:String,arr:Array=null):void
{
this.data = arr;
super(type);
}
}
}
Event dispatches by following way
dispatchEvent(new UploadEvent(UploadEvent.UPLOAD_FILE_COMPLETD,data[Array]));
Handler function for the dispatched event as follows
[Event Dispatcher Instance].addEventListener(UploadEvent.UPLOAD_FILE_COMPLETD,onUpoadComplete);
private function onUpoadComplete(evt:UploadEvent):void
{
trace(evt.data);
//handle code here;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment