Archive for November, 2007

0

QueueLoader + Stable Rev


Latest Version Info:
Click here for the current rev

Click here for the usage guide

Click here for the change log

Also click here for any posts related to the latest changes:
QueueLoader Updates

5

F.D.T. 3.0 + Code Templates


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

  • Right click on the eclipse application and select show package contents. Open Contents/Mac Resources/Eclipse.ini and change -Xms40m to -Xms256m and -Xmx256m to -Xmx512m

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:

trace(">> ${enclosing_type}.${enclosing_method}() - args: "+[${enclosing_method_arguments}]);

Public Method:

public function ${methodName}():${type} {
    trace(">> ${enclosing_type}.${methodName}() args: "+[]);
    ${cursor}
};

Browser Based Alert Debugging:

SendJavascript.getInstance().debug("${enclosing_type}.${enclosing_method}()");

Go here for info on this one.

0

ADDED_TO_STAGE + IE6 + Debugging


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:

SendJavascript.getInstance().debug("${enclosing_type}.${enclosing_method}()");

Here's the script added to the html:

<script language="JavaScript">
function sendToJavaScript(value) {
     alert(value);
}
</script>

Here's the updated Class:SendJavascript Debug UpdateYou can see more info on this class as well here.

01

GO Tweening System


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:

import com.hydrotik.go.SepiaTween;
import org.fuseproject.go.events.GoEvent;
import fl.motion.easing.Sine;
 
// 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;
	}
 
}

GO Sepia Source


HydroTween 0.4.4 Source and Example

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:

import com.hydrotik.go.SepiaTween;
import org.fuseproject.go.events.GoEvent;
import fl.motion.easing.Sine;
 
// 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;
	}
 
}

GO Sepia Source


HydroTween 0.4.4 Source and Example

5

TextAnimator AS3


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.

import br.hellokeita.anim.TextAnimation;
 
 
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.


TextAnimator Update Source

0

Petronas Towers 2


Another shot of the Patronas.

2

Petronas Towers 1


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!

20

QueueLoader AS3 rev 8


Latest Version Info:
Click here for the current rev

Click here for the usage guide

Click here for the change log

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.

4

SoundManager Rev 2 + Loop Sequencing


I've updated SoundManager with a couple new features.

  • Manual and Automatic step based sequencing of loops.
  • Cross Fading between manual loop transitions.
  • Panning.
  • Global fade out, disabling and enabling

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:

import com.hydrotik.utils.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:

SoundManager.getInstance().startSequencer("Loop1");

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:

SoundManager.getInstance().addSequenceItem("Loop2", false);

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:

SoundManager.getInstance().startSequencer(["Loop1, Loop1, Loop2, Loop2, Loop3, Loop3"]);

The above will automatically play each loop in order and then stop at the end.

Here's a diagram of the sequencing:

soundmanager_sequencing.gif

There are a number of features that I plan on adding and/or enhancing:

  • Some way to indicate cross fading in an automatic sequence
  • XML input of sequences
  • BPM output
  • Specifying of multiple phrases before the upcoming loop starts (I.e. play the loop 4 times before progressing)

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

import com.hydrotik.utils.SoundManager;
 
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:


Sound Manager Rev2 Source

bottega veneta deep coffee pocket bag deep weight loss pills bingo and game casino gambling online virtual how to win at slots versace deep coffee venus bag women does viagra work online bingo uk discount drugstore where to get viagra or cialis diazepam cheap without rx bingo and slots does cialis really work bingo gaming chanel yellow shoulder bag bingo for cash slot machine buy meds online without presciption lancel pearl premier flirt prada white shoulder bag prescriptions pain killers without a prescription viagra product information cialis generic levitra viagra cialis male enhancement online gambling offers manolo blahnik beige hangisi valium indications anya hindmarch beige hobo how does diazepam work who has the cheapest cialis price for tramadol levitra website price for generic viagra top anti depressants pharmacy zolpidem marc jacobs antique gold keylock messenger bag pill for acne casino gambling buy carisoprodol cheap create poker website zyban tablet jimmy choo purple wells shoes valtrex medication counseling for erectile dysfunction hey bingo louis vuitton patent beige sandals louis vuitton monogram idylle pink tote power bingo slot games gucci black evening bag xanax fedex oral jelly viagra new casino slots discount erectile dysfunction medication christian louboutin white ambrosina pumps poker machine games buy no phentermine prescription high stakes poker buy tory burch golden reva ballerina flats casino locations roulette casinos play online casinos bingo and slots viagra effect on women louis vuitton damier graphite keepall bandouliere marc jacobs royal blue keylock shoulder bag play roulette online casino mania online buy compazine buy gucci black trainers online casinos en internet how to win slots christian louboutin blush barcelona sandals prescription diet drugs us only mobile casino games natural clomid buy overseas viagra online casino canada online xanax fedex norvasc generic erectile dysfunction products zoloft canada uk viagra supplier casino bonus tory burch deep blue tory logo rain boots poker for money prescription drugs online adipex no prescription needed pharmacies geniune cialis no prescription ambien dosing how do muscle relaxants work valentino beige snakeskin clutch what is tadalafil ativan dosages sales viagra ysl white muse bag cialis to buy online gambling strategy cheapest phentermine pills christian dior biege medium saddle handbag alprazolam brand cheap viagra new zealand low cost adipex bally patent patent red jana tote ambien pharmacy manolo blahnik bow booties what is viagra used for dosage viagra new diet pill fda approved play slots online now cialis best price las vegas bingo cialis generic tabs versace purple venita bow satchel chloe patent purple cyndi tote fendi apricot snake peekaboo handbag discount lipitor prescription ambien ambien 10mg poker us levitra free samples do meridia phentermine work the same order celine black shoulder bag louis vuitton patent black sandals over the counter medication cheap 37 5 phentermine safe effective diet pills loewe white handbag dolce gabbana black trainers buying phentermine alprazolam generic for xanax ativan 2mg prada beige fairy l bag generic cialis canadian diet phentermine viagra online cheap europe cialis platinum play bingo levitra info prescription drugs migraines levitra alternative phentermine ingredient how does cialis work louis vuitton damier azure canvas galliera gm order amoxicillin new arthritis and psoriasis drug lipitor online pharmacy professional blackjack how does cialis ultram ingredients