通常我很擅长在 as3 上工作,但这个真的让我头疼
我在下面有这段代码,一切正常我可以跟踪输出,但文本仍然没有出现在舞台上任何线索?
import flash.display.Sprite;
import flash.text.TextField;
import flash.display.MovieClip;
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
var total:XMLList;
var totalPram:XMLList;
var totalImgs:XMLList;
var totalX:XMLList;
var totalY:XMLList;
var totalInfo:XMLList;
var pram:XML;
var img:XML;
var playHead:Number=0;
var spacer:Number=20;
var xpos:Number=300;
var ypos:Number=100;
/////////////////////////////// formating ///////////////////////////////////
var newFormat:TextFormat = new TextFormat();// Text formating
newFormat.size=30;
newFormat.bold;
newFormat.font="Arial";
newFormat.color="0xCBFF00";
//newFormat.leading=-7;
////////////////////////////////////////////////////////////////////////////
xmlLoader.load(new URLRequest("info_1.xml"));
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
//var tagHolder:MovieClip = new MovieClip();
function LoadXML(e:Event):void {
xmlData=new XML(e.target.data);
xmlData.ignoreWhite=true;
Parseinfo(xmlData);
}
function Parseinfo(Details:XML):void {
total=Details.blink;
totalPram=Details.blink.tag;
totalInfo=Details.blink.more;
totalImgs=Details.blink.img;
totalY=Details.totalY.ypos;
totalX=Details.totalX.xpos;
for (var i=0; i<=1; i++) {
//addChild(tagHolder);
pram=totalPram[i];
var labels:TextField=new TextField ;// txtfield for questions to be displayed
labels.setTextFormat(newFormat);
//mytxt2.autoSize=TextFieldAutoSize.LEFT;
labels.embedFonts=true;
labels.text=pram;
labels.x=xpos+spacer;
labels.y=ypos;
trace(labels.text);
addChild(labels);
}
}