Return to Snippet

Revision: 11235
at January 28, 2009 15:37 by antpaw


Initial Code
// XML LOAD
var myXML:XML = new XML();
var XML_URL:String = "newsXML.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);


// HEADLINE
var headLineFormat:TextFormat = new TextFormat();
var headLineX:Number = 0;
var headLineY:Number = 0;

headLineFormat.color = 0xFFFFFF;
headLineFormat.font = "Arial";
headLineFormat.size = 36;
headLineFormat.bold = true;


var shadowHL:DropShadowFilter = new DropShadowFilter();
shadowHL.color = 0x000000;
shadowHL.blurY = 12;
shadowHL.blurX = 12;
shadowHL.alpha = 1;
shadowHL.distance = 0;
var filtersArray:Array = new Array(shadowHL);


function xmlLoaded(event:Event):void
{
	myXML = XML(event.target.data);
	for (var i:Number = 0; i < myXML.news.headline.length(); i++)
	{
		// HEADLINE
		var headLine:TextField = new TextField();
		addChild(headLine);
		headLine.text = myXML.news[i].headline;
		headLine.y = headLineY;
		headLine.x = headLineX;
		headLine.width = 70;
		headLineY -= 50;
		headLine.wordWrap = true;
		headLine.autoSize = TextFieldAutoSize.LEFT;
		headLine.setTextFormat(headLineFormat);
		headLine.filters = filtersArray;
	}
}

Initial URL

                                

Initial Description
and  DropShadow Filter :)

Initial Title
XML Loop in ActionScript 3

Initial Tags
xml

Initial Language
ActionScript 3