Select Page

Ever wondered how to send parameters with your event in AS3.0?

package com.sitedaniel.events {
	import flash.events.Event;
	dynamic public class DynamicEvent extends Event {
		public function DynamicEvent(t:String,
                                         b:Boolean = false,
                                         c:Boolean = false){
			super(t, b, c);
		}
	}
}

By setting this class to be dynamic (using dynamic keyword) you are able to add values to your event object:

_dynEvent = new DynamicEvent(LOAD_PROGRESS);
_dynEvent.id = _id;
_dynEvent.bytesLoaded = bytesLoaded;
dispatchEvent(_dynEvent);