Archive for March, 2005

Extending mx.transitions.Tween

This is a really cool AS 2.0 class for extending the mx.transitions.Tween class to pass multiple properties. I wish I had know about this before. I just finished up a small project where I was doing multiple lines of mx.transistions.Tween when I didn’t need to be.

Here is some sample code on using the mx.transitions.TweenExtended once you installed it. This sample is moving the movieClip, ball_mc, to the position of 700×400 and also modifying its _alpha property. All in one line of code. Nice!!!
[as]
// import the Class
import mx.transitions.TweenExtended;
// I like defining the easingType as a variable, but it could be directly in the new TweenExtended line
easingType = mx.transitions.easing.Back.easeOut;
extendTween = new TweenExtended(ball_mc,["_x","_y","_alpha"],easingType,[ball_mc._x,ball_mc._y,ball_mc._alpha],[700,400,25],2,true);
[/as]

The file is available for download from Square Circle Solutions [ link ]. Check the page out because there is some other cool stuff there as well.

(original story via FlashGuru)
One of the main features that the Macromedia Tween Class is lacking, is the ability to tween multiple properties of a movieclip using one instance of the tween class. My friend George has released a TweenExtended class that extends the Macromedia mx.transitions.Tween code allowing you to tween multiple properties with one instance of the class and alot less code.

You can download the class and many more goodies at our website:

http://www.sqcircle.com/downloads/

Mac Mini has arrived

Mac Mini box
Even the Mac Mini box was almost smaller than the small form factor Shuttle PC I have.

Mac Mini
Once its been unwrapped, it even got smaller, but not lighter. The mini may be small..but not light.

Pretty mini next to the SFF PC
Its final resting place on top of the Shuttle box.

All ready to go
All booted up and no where to go… yet.. ;)

Basic XML with Flash

Someone had asked me today how to use XML with Flash. He is interested in using a XML file to configure a game he wants to write. He wants to write a Monopoly-like game but be able to quickly reconfigure the game board based on the location he wants to use. I wrote up a very basic sample file for him and I thought I would share it here.

[as]
var myXML:XML = new XML(‘‘);

trace(“Number of board nodes=”+myXML.firstChild.childNodes.length);
numNodes = myXML.firstChild.childNodes.length;
for (i=0;i trace(myXML.firstChild.childNodes[i].attributes.name +” has a rent of $”+myXML.firstChild.childNodes[i].attributes.rent);
}
[/as]

Now this sample uses XML directly within the ActionScript, but it is done the same way using external XML, except you would have a myXML.load(“config.xml”) and then need a myXML.onLoad function handler.

New iPod Mini

My new iPod Mini arrived the other day… well, it was mine for about 5 hours. It was really bought for my wife, but I got to play with it until she got home from work. ;)

Her computer is an “old” dual AMD MP BoxxTech machine and was well before FireWire and USB 2.0 was common. I had picked up a USB 2.0 PCI card the other day and got it installed in her machine. After the quick install of the USB 2.0 card, I was ready to get using the iPod Mini.

I had played with the iPod Mini in the Apple stores before, but somehow it just felt smaller now. It took me a little bit to get used to the controls (ok — i didn’t read the manual first). Anyhow.. it wasn’t long before the wife got home and started loading it up with all her music for running/walking while training.

I’ll probably never see the iPod again — but that’s okay — my Mac Mini should be arriving in a week or two and I’ll get my new “toy”.

ActionScript — Use mx.transitions.Tween

Using the mx.transitions Class is very easy and a simple way to tween stuff that used to take a LOT longer to do the “old-way”.

Syntax:

referenceID = new mx.transistions.Tween( InstanceName, “_property”, easingType, beginning value, ending value, # of frames or seconds, boolean);

Example:

[as]

easeType = mx.transitions.easing.Strong.easeOut;
myTween = new mx.transitions.Tween(myMovieClip_mc, “_x”,easeType, 0, 600, 20);

// onMotionFinished is called when the tween is complete
myTween.onMotionFinished = function() {
trace(“myMovieClip_mc has finished moving.”);
};
[/as]

A really good tutorial on mx.transitions is available over at ActionScript.org

Return top