QueueLoader + Stable Rev
Latest Version Info:
Click here for the current rev
Click here for the usage guide
Also click here for any posts related to the latest changes:
QueueLoader Updates
Tuesday, November 20th, 2007
Latest Version Info:
Click here for the current rev
Click here for the usage guide
Also click here for any posts related to the latest changes:
QueueLoader Updates
Tuesday, November 20th, 2007
The folks over at F.D.T. were kind enough to bestow me with an enterprise license for the QueueLoader and SoundManager project. Many thanks to them! I had dabbled with the beta version, but haven’t had much of a chance to get back into the FDT world until recently. Now that I have been using it again, I remember how much I hate coding in the IDE. Here’s some info to get you up and running.
Installing or updating to the new version is a breeze. Whereas before you needed to link a special FDT modified code library, now it automatically links to the global SWC file.
When installing or upgrading to 3.0 you’ll need to do this: (I’m on a Mac so if you are on a PC, you’ll need to find instructions.)
Code Templates: Code templates or code snippets are one of the many ways to work quickly within FDT. Go to preferences FDT>Editor>Templates and click New and you can set up a new code template. The template will let you insert java variables that will automatically be replaced with page elements. ${enclosing_type} will turn into the Class name. ${enclosing_method} will turn into the function name. Once you have the templates set up when you are coding in a class you press control and space and the template menu will come up. Start typing the code template name and hit enter and there is your code snippet with the variables replaced by it’s respective names. Here are some of my favorites you can paste into the template window:
Trace:
Public Method:
Browser Based Alert Debugging:
Go here for info on this one.
Monday, November 19th, 2007
Let me start off by saying Event.ADDED_TO_STAGE does NOT work in IE6. I spent the better part of today debugging to finally track the culprit down to this event. This flip side to this is I figured out a gorilla method for debugging and getting to the source of the problem.I added a method to my SendJavascript singleton class called debug() that fires an ExternalInterface function (I might convert the rest of the class tp ExternalInterface at some point if I find it works better then the way it is now). This in turn is connected to a javascript that generates an alert box. Surprisingly enough, when the alert box would popup on screen, the code running in the SWF would stop. By moving this method around my application I was able to figure out that if the alert came up all was well. If it didn’t come up then I knew it was located beyond the trouble spot. By continuously narrowing the bookends of the alert calls I tracked the issue down to the event. Reminded me of using signal flow to track down a hum in an audio path.I took it a step further and created an F.D.T. code template that allowed me to insert the call. This made it speedy as it would automatically insert the class method and the enclosing method.Here’s the template code:
Here’s the script added to the html:
Here’s the updated Class:SendJavascript Debug UpdateYou can see more info on this class as well here.
Monday, November 19th, 2007
Check the most recent Go post for updates to HydroTween
I finally got a chance to play with Moses’ new AS3 tweening system “GO”. It’s very, very cool, and very powerful. The only drawback to this is it takes a bit more work and is a little more advanced then the average tweening engine. However for advanced developers comfortable with customizing and modifying a tweening engine, GO will be a natural solution especially for big projects.
Go here for updates and info on the GO System.
I’m looking forward to seeing what other people come up with and how they extend the functionality of GO. This was a simple example but I plan on abstracting out the array tweening function so it can be used in other situations. Hopefully people will catch on to this and a library of extensions will develop. I think once that happens it will become very accessible to all developers.
Here’s the current code example:
// Add Interaction
image.addEventListener(MouseEvent.CLICK, imageHandler);
image.buttonMode = image.mouseEnabled = image.useHandCursor = true;
var isSepia:Boolean = false;
// Setup our sepia matrix
var sepiaColor:Array = [
0.3930000066757202, 0.7689999938011169, 0.1889999955892563, 0, 0,
0.3490000069141388, 0.6859999895095825, 0.1679999977350235, 0, 0,
0.2720000147819519, 0.5339999794960022, 0.1309999972581863, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
];
var nullColor:Array = [
1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
];
// Setup GO
var oGo:SepiaTween = new SepiaTween(image, sepiaColor, 0, 3, Sine.easeInOut);
oGo.addEventListener(GoEvent.START, goHandler);
oGo.addEventListener(GoEvent.UPDATE, goHandler);
oGo.addEventListener(GoEvent.END, goHandler);
// Handlers
function imageHandler(event:MouseEvent):void{
oGo.matrix = (isSepia) ? nullColor : sepiaColor;
oGo.start();
isSepia = !isSepia;
}
function goHandler(event:GoEvent):void{
switch (event.type) {
case GoEvent.START:
trace(“start”);
break;
case GoEvent.UPDATE:
trace(“update”);
break;
case GoEvent.END:
trace(“end”);
break;
}
}
Tuesday, November 13th, 2007
keita over at labs.hellokeita.com has a great utility for animating/typing text here.
The click me link will show up in the output of flash as it is a trace statement.
TextAnimation.animate(“”,
“Welcome to <font color=’#FF0000′><a href=’http://labs.hellokeita.com’>labs.hellokeita.com</a></font><br>”+
“Some more text.<br><a href=’event:hello world!’><font color=’#FF0000′>Click Me.</font></a><br><br>”+
“Welcome to <a href=’http://blog.hydrotik.com’><font color=’#990000′>blog.hydrotik.com</font></a><br>”+
“Some more text.<br><a href=’event:hello world 2!’><font color=’#990000′>Click Me.</font></a>”, {
textField: tf,
step: 5,
time: 5,
delay: 0,
characters: “0123456789-#”,
transition: “easeInOutCubic”
});
var style:StyleSheet = new StyleSheet();
var a:Object = new Object();
a.color = 0xFF0000;
style.setStyle(“a:hover”, a);
tf.addEventListener(“link”, clickHandler);
function clickHandler(e:TextEvent):void {
trace(e.type); // link
trace(e.text); // myEvent
}
keita did a great job on this. I simply made a slight modification that allows for href tags as well as nested tags and corrected an import link path. I think he plans on adding support for all tags at some point.
Monday, November 12th, 2007
This is the first post and the first couple of images from my Dad’s trip to India. He left early Nov. and will return at the end of Feb. He’s currently in Kuala Lumpur. I’m sure at some point I will give him access to post on his own so he can share his journey with friends and family.
Love you Dad and enjoy!
Monday, November 12th, 2007
Latest Version Info:
Click here for the current rev
Click here for the usage guide
Also click here for any posts related to the latest changes:
QueueLoader Updates
There have been a number of valid requests and great suggestions for enhancement, so I’m inviting help in the hopes of making QueueLoader better and better. Contact me there if you are interested in helping:) I’ve removed the examples thanks to the wordpress update and new editor screwing up the code formatting. I got it under control now, but you can see the example in the source. Download the stable file in the most recent post here, or check out the new features in development on in the svn.
Sunday, November 11th, 2007
I’ve updated SoundManager with a couple new features.
The sequencing is the really promising addition to this revision. I’m excited about this as I have a background in the Recording Engineering industry as well as doing underground dance music production. Before I get started, I must say that it’s not quite perfect yet. There is an issue with loops transitioning seamlessly depending on the processor load. It’s much much better then in AS2, but it still happens. If you’re dealing with audio/music that isn’t heavily dependent precise tempos, then you should be ok. If you are, then just be aware of this issue if your swf has a lot going on in it. I have a couple of ideas on how to fix this, but I want to make sure it’s efficient on the processor and continue doing more research on this first. I also need to get up to speed and/or get some hep with ByteArray level loading:)
Before using the sequencing feature, all loops need to be added/registered with the SoundManager:
SoundManager.getInstance().addItem(new Loop1());
SoundManager.getInstance().addItem(new Loop2());
SoundManager.getInstance().addItem(new Loop3());
// etc…
All the above loops are registered using the library class references such as Loop1(). They can be later accessed using the string such as “Loop1″ as you will see below.
The SoundManager now has two new methods for setting up looping. The previous and still useful method is just by setting the number of loops in the play() arguments. The new methods use:
No depending on if you add a single String for the Sound ID or an Array. Using a single String will start the sequencer in auto mode. The loop you specify in the String will continuously loop until you use the method:
The first item is the String for the next sound. The is added to the sequence and starts as soon as the playing loop reaches the end. The second argument is a true/false for cross fading between loops.
For automatic sequencing you simple add an Array of Sound ID strings:
The above will automatically play each loop in order and then stop at the end.
Here’s a diagram of the sequencing:

There are a number of features that I plan on adding and/or enhancing:
I’ve omitted the source fla for the external sounds in the QueueLoader example because of the file size. Here’s the code that is on the first frame of the externalsounds.swf
SoundManager.getInstance().addItem(new Loop1());
SoundManager.getInstance().addItem(new Loop2());
SoundManager.getInstance().addItem(new Loop3());
SoundManager.getInstance().addItem(new Loop4());
All of the above class references “Loop1″, etc. are located in the Library with the respective export for actionscript labels.
A number of people have been doing great work on audio processing and ByteArray streaming of PCM sound data, etc. Parsing the byte level data of loaded items is very tedious, but I plan on looking into this as a possbility for addressing the looping issue as well as other features.
I plan on including this code with a working example in the next revision of QueueLoader which I plan on posting soon. In the meantime, here’s the source:
Saturday, November 10th, 2007
© 2008, hydrotik | flash development / design / photography. All Rights Reserved.