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
10Jun

ArrayForEach Method

No comments

If you ever need to run a function on all items within an array, you can use the ArrayForEach Method.


Here is the document class:

package {
import flash.display.Sprite;
import fl.controls.TextArea;
import fl.controls.ScrollPolicy;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormat;

public class ArrayForEach extends Sprite {

private var output:TextArea;

public function ArrayForEach()
{
// Build the [...]

Categories: Actionscript 3, Arrays
09Jun

Sorting Arrays with Array.SortOn Method

No comments

This came in handy for my carousel animation. It helped resort the objects z-index based on it’s scale parameter.

package
{
import flash.display.Sprite;
import fl.controls.TextArea;
import fl.controls.ScrollPolicy;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormat;

public class ArraySortOn extends Sprite
{
private var output:TextArea;
private var Arr:Array;
private var ConcatArrays:Array;
private var msgString:String;

public function ArraySortOn()
{
init()
}

private function init():void
{
// display our output field
Output();

// set up the arrays
Arr = [...]

Categories: Actionscript 3, Arrays
05Jun

Testing an Array with the Array.every() Method

No comments

If you ever need to test an array to see if it passes a specified criterion, then Array.every() is the method to use. This method will run a function on each array item until it returns false.

package {
import flash.display.Sprite;
public class ArrayEvery extends Sprite {
public function ArrayEvery() {

var [...]

Categories: Actionscript 3, Arrays
04Jun

Combining Arrays with the Array.Concat Method

No comments

The Actionscript Document Class:

package
{
import flash.display.Sprite;
import fl.controls.TextArea;
import fl.controls.ScrollPolicy;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormat;

public class ArrayConcat extends Sprite
{
private var output:TextArea;
private var ArrOne:Array;
private var ArrTwo:Array;
private var ConcatArrays:Array;

public function ArrayConcat()
{
init()
}

private function init():void
{
// display our output field
Output();

// set up the arrays
ArrOne = new Array(1, 2, 3);
ArrTwo = new Array(4, 5, 6);
ConcatArrays = ArrOne.concat(ArrTwo);

// display the output
msg ( [...]