| Flashscript classes (ActionScript 3) | Home | MX | MX 2004 | Flash 8 | Flash 9 |Flash 10 |PHP |Components | Snippets | Contact | |
ArrayConvert |
|
|
| Property | Defined By |
|---|---|
|
newArray
: Array
An array containing all variables from the text file. |
ArrayConvert |
| Method | Defined By |
|---|---|
| ArrayConvert(textFile:String) | ArrayConvert |
| Event | Defined By |
|---|---|
|
arrayComplete This event is dispatched when the textfile has been loaded and the variables been extracted. |
ArrayConvert |
| All inherited events for the EventDispatcher class. | N/A |
| Property Detail |
|---|
|
newArray
property
newArray:Array [read-write] This sets the initial value for the alpha fading. There is no default value. Implementationpublic function get newArray():Arraypublic function set newArray(value:Array):void |
| Constructor Detail |
|---|
|
ArrayConvert () Constructor
public function ArrayConvert(textFile:String) |
| Intializes a new ArrayConvert instance with the specified parameters. |
Parameters
|
| Event Detail |
|---|
|
arrayComplete event
Event Object Type:
biz.flashscript.utils.ArrayConvert
Dispatched when the file was loaded and the variables been extracted. |
| Examples |
|---|
|
Create a new fla file and name it ArrayConverter.fla. Place the fla in the same folder as the biz folder. Add a TextField and name it myText. In a folder named "text_files" have a file named "textexample.txt". Then create an Actionscript file, name it ArrayConverter.as and place this script.
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import biz.flashscript.utils.ArrayConvert;
public class ArrayConverter extends Sprite
{
private var var1:Array;
public function ArrayConverter ():void
{
var ac:ArrayConvert = new ArrayConvert("xml_files/varexample.txt");
ac.addEventListener (ArrayConvert.ARRAY_COMPLETE, compHandler);
but.label = "Values";
but.addEventListener (MouseEvent.CLICK,butHandler);
/*******Split array at , important for array strings from mysql ********
import biz.flashscript.utils.ArrayConvert;
var var1:Array;
var ac:ArrayConvert = new ArrayConvert();
ac.addEventListener (ArrayConvert.ARRAY_COMPLETE, compHandler);
function compHandler (e:Event):void
{
var1 = e.currentTarget.newArray;
trace(var1[1]);
}
ac.splitString("(xvxcvxv|111|333|bcbcb),(sdgffdg|444|666|vnvnvn)");
*************************************************************************/
}
private function compHandler (e:Event):void
{
var1 = e.currentTarget.newArray;
}
private function butHandler (e:MouseEvent):void
{
for (var i=0; i < var1.length; i++)
{
myText.appendText (var1[i].varName+"="+var1[i].varId+"\n");
}
}
}
}
The following Textfile (varexample.txt) is used in this example: aValue=700&bValue=100&cValue=400&xValue=1000&yValue=300 |