21Aug

Trails Animation

No comments

This code was submitted to me via email who requested some assistance to get this trailing animation to be bound by any newly created object. I edited the code slightly and added a Rect class to build my rectangle object (which could be replaced by an image if so desired). I added a timer to [...]

18Jul

Associative Arrays with the Object Class

No comments

To create an associative in Actionscript 3 you will need to use the object class because of the named elements (vs. the numbered elements).

var assocArr:Object = {fName:”Morgan”, lName:”Newcomb”};
trace(assocArr.fName); // Output: Morgan
trace(assocArr["lName"]); // Output: Newcomb

To add an element, you can add this to your code

assocArr.mi = “A”;
trace(assocArr.mi); // Output: [...]

Categories: Actionscript 3, Arrays
17Jul

For Each Loop Construct

No comments

Just another way to read items in an array:

// Init the array
var myArr:Array = ["one", "two", "three"];

// Read the values of the array
for each ( var items:String in myArr ) {
trace( items );
}

a2a_linkname=”For Each Loop Construct”;
a2a_linkurl=”http://manewc.com/2008/07/17/for-each-loop-construct/”;
a2a_color_main=”D7E5ED”;a2a_color_border=”AECADB”;a2a_color_link_text=”333333″;a2a_color_link_text_hover=”333333″;

Categories: Actionscript 3, Arrays
18Jun

Erasing All Items in an Array with Slice Method

No comments

Because I occasionally build arrays with the push method, there was an occurrence where I need to wipe it out entirely. I was able to do so with the Slice Method. It is simply:
myArray.slice ( 0 );
The parameter of 0 will wipe out all items after the first element of your array. It will accept [...]

Categories: Actionscript 3, Arrays
16Jun

Identifying A Class Object with Mouse Click Event’s currentTarget

No comments

I have noticed that the currentTarget from a MouseEvent driven function will produce the respective object that has called such function.
I have a class that will reproduce X number (in this case 10) of objects (from the c.as file -> just circle renderings) - I just simply wanted to identify each object that is [...]

Categories: Actionscript 3, Arrays