ActionScript 3中的XML循环
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3中的XML循环相关的知识,希望对你有一定的参考价值。
and DropShadow Filter :)
// 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; } }
以上是关于ActionScript 3中的XML循环的主要内容,如果未能解决你的问题,请参考以下文章
ActionScript 3 如何在eclipse中的工作区之间移动片段
在Adobe Animate ActionScript 3.0中循环