Select Page

Dynamic Events in AS3.0

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);

Apache named-based virtual hosts

Trying to set up some subdomains on sitedaniel.com, I had some problems configuring my Apache to deal with the different incoming domains.

The problem was my NameVirtualHost wasn’t defined, and all subdomains were directed to the default directory. Finding documentation on this was a little tricky as NameVirtualHost wasn’t even in my httpd.conf file. However once I defined this, they all worked perfectly.

NameVirtualHost *

Also I found that having the path to the directory in quotes or not in quotes didn’t matter. Another thing I discovered is that if there is no name match, it will default to the first reference, so putting this somewhere unique (or to your root) might help you debug if there are problems.

Customising the FlashDevelop Class templates

Here’s how to update the new Class template text in FlashDevelop.
Out of the box, if you hit Ctrl+1 you’ll get this:

/**
* ...
* @author Default
*/

class {

}

So that you don’t have to add in your name every time, you can edit the template here:

Tools -> Application Files…
Templates/ AS3.fdt (AS2.fdt)

You can add in your URL as well:

package $(CSLB){

	/**
	* ...
	* @author 	Daniel
	* @url		http://www.sitedaniel.com
	*/
	public class $(EntryPoint) $(CSLB){

	}

}