AS3 Flash | Give result to XML variable

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseBooks(xmlData);
}
function ParseBooks(bookInput:XML):void {
trace("XML Output");
trace("------------------------");
trace(bookInput);
}

p1

AS3 Flash | Load External XML with urlLoader

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("http://www.kirupa.com/net/files/sampleXML.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
trace(xmlData);
}

p1

AS3 Flash | Load External XML with urlLoader

AS3
===
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
xmlLoader.load(new URLRequest("playlistAS3.xml"));

funciton
========
function showXML(e:Event):void {
XML.ignoreWhitespace = true;
var songs:XML = new XML(e.target.data);
trace(songs.track.length());
var i:Number;
for (i=0; i < songs.track.length(); i++) {
trace(" Name of the song: "+ songs.track[i].title.text());
trace(" Name of the Band: "+ songs.track[i].band.text());
trace(" File Location of the song: "+ songs.track[i].file.text());
}
}



p1

AS3 Flash | Dispatchevent

import flash.events.Event;

dispatchEvent(new Event("closedPopUp"));

p1

AS3 Flash | Automatically Action using Timer Class

  1. var timer:Timer = new Timer(1000, 2);
  2. timer.addEventListener(TimerEvent.TIMER, blah);
  3. timer.start();
  4. function blah(e:TimerEvent):void{
  5. trace("Times Fired: " + e.currentTarget.currentCount);
  6. trace("Time Delayed: " + e.currentTarget.delay);
  7. }
to be continue

p1

AS3 Flash | Coding Object have shadow effect

var logo:FlashEssential = new FlashEssential();
var dropShadow:DropShadowFilter = new DropShadowFilter();
logo.filters = [dropShadow];

dropShadow.distance = 1;
dropShadow.alpha = .2;
dropShadow.blurX = 10;
dropShadow.blurY = 10;
addChild(logo);

(correct it later)

p1

AS3 | Array

Create Array

var myArray:Array = new Array("A", "B", "C");

Using element of an Array

trace(myArray[2]);

output is: C

Adding element to array

1- myArray[3] = "D"; // create element at 3th site of the array
2-
myArray.push("D"); //create element after the last site of the array

Changing element of the array
myArray[3] = "Changed D"

(to be continue)

p1

AS3 Flash | Dynamic Textfield autoSize

This will make the Dynamic Text auto resizing to fit long of text.

Once create dynamic text. set Behavior to Single line



When you set the text to this text field, you just code like this :
menuTextNormal.autoSize = TextFieldAutoSize.LEFT;
menuTextNormal.text = _menuText;

That's done.

p1