Identifying A Class Object with Mouse Click Event’s currentTarget
No commentsI 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 [...]
ArrayForEach Method
No commentsIf 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 [...]
Sorting Arrays with Array.SortOn Method
No commentsThis 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 = [...]
Testing an Array with the Array.every() Method
No commentsIf 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 [...]
Combining Arrays with the Array.Concat Method
No commentsThe 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 ( [...]