01
May 08
I use a folder structure for my projects that has a dev folder for .fla, classes folder for classes(whowouldathought), library folder for all visual assets and fonts etc, and a www folder for all published content. Flashdevelop doesn’t have a project template that supports this by default, but it is incredibly easy to create one.
All that needs to be done is to navigate to c:program filesFlashDevelopfirstrunTemplatesProjectTemplates copy the project folder you currently use, change the name, go in add/delete whatever folders you want to be made when a new project is, and edit the .as3proj file in notepad++ or similar text editor. It’s a very straight forward edit, all i changed was default classpath, and now i’m kicking ass!
10
Dec 07
I've had this code around since my as 2.0 devirginizing(awhile ago..ahaha) So I decided to transfer it into AS3. It's a very simple class, but what it does is pretty cool, basically you can have events that aren't tied to specific classes or objects. Basically class A can talk to class D without knowing who class D is... just knowing it has to send out an event... if that makes sense. While i think the way Events especially in AS3 are great, and i will use them more often than not... its always nice to have something to fall back on when you need 2 or more things to talk without necessarily knowing who they are. Heres my source :
Actionscript:
-
package com.rLuce.utils {
-
public class EventManager {
-
/*
-
* Event Manager: Ryan Luce
-
* Methods:
-
* addEventListener : Adds an event to the list
-
* dispatchEvent : Calls all functions related to that Event, and passes an object(or Event) if necessary
-
*
-
* */
-
-
private static var Events:Array = [];
-
//Standard addeventlistener
-
public static function addEventListener(eventName:String, fncRef:Function):void
-
{
-
if(Events[eventName] != null) {
-
Events[eventName].push(fncRef);
-
} else {
-
Events[eventName] = [];
-
Events[eventName].push(fncRef);
-
}
-
}
-
-
public static function removeEventListener(eventName:String, fncRef:Function):void
-
{
-
//this hasn't been tested i think i need to slice(a, (a + 1)) if my logic is even right
-
//haven't had to get into this and this was a quick port from my as2 class which was a bit different
-
for(var a:Number = 0; a <Events[eventName].length; a++)
-
if(Events[eventName] == fncRef)
-
trace("Removing: " + Events[eventName].slice(a,a));
-
}
-
-
public static function dispatchEvent(eventName:String, obj:*= null):void
-
{
-
if(Events[eventName] != null)
-
for(var a = 0; a <Events[eventName].length; a++)
-
Events[eventName][a](obj);
-
}
-
}
-
}
Usage for this is pretty simple, just like the normal event dispatcher. I haven't tested this thoroughly yet, and will this coming week... will update it when i have time. I'll post a file up here as well with the class... to make it a bit easier.
Edit: Here you go: (right click save as)
EventManager.as