我正在嘗試使用XML和動作腳本3將文本嵌入到Flash中。我發現代碼適用於我,但我不知道如何更改字體和字體大小操作腳本。在ActionScript 3中更改字體系列和字體大小
你能幫我嗎?謝謝!
我的AS3外商投資企業是這樣的:
var yPlacement:int = 20;
var xPlacement:int = 30;
var distance:int = 60;
var myFormat:TextFormat = new TextFormat();
myFormat.color = 0xAA0000;
myFormat.size = 24;
myFormat.italic = true;
myFormat.align = TextFormatAlign.CENTER
var myXML:XML = new XML();
var XML_URL:String = "myXMLFile.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void {
myXML = XML(myLoader.data);
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = true;
var menuXML:XML = XML(myLoader.data);
xmlDoc.parseXML(menuXML.toXMLString());
for each (var ListItem:XML in myXML..ListItem) {
var listColor:String = ListItem.itemColor.toString();
var listLabel:String = ListItem.itemLabel.toString();
var listPhone:String = ListItem.itemPhone.toString();
var myText1:TextField = new TextField();
myText1.text = listLabel;
myText1.autoSize = TextFieldAutoSize.LEFT;
myText1.x = 2;
myText1.y = 2;
var myText2:TextField = new TextField();
myText2.text = listPhone;
myText2.autoSize = TextFieldAutoSize.LEFT;
myText2.x = 2;
myText2.y = 20;
var clip_mc = new MovieClip();
clip_mc.addChild(myText1);
clip_mc.addChild(myText2);
addChild(clip_mc);
clip_mc.y = yPlacement;
clip_mc.x = xPlacement;
yPlacement = yPlacement + distance;
}
}
和XML文件的樣子:
<?xml version="1.0" encoding="utf-8"?>
<XML>
<myXMLList>
<ListItem>
<itemColor>FFFFFF</itemColor>
<itemLabel>NÃO ACORDES O DRAGÃO</itemLabel>
<itemPhone>SÁBADO - 14H00</itemPhone>
<itemSize>32</itemSize>
</ListItem>
<ListItem>
<itemColor>FFE8E8</itemColor>
<itemLabel>Emily Owen</itemLabel>
<itemPhone>888-888-8888</itemPhone>
</ListItem>
<ListItem>
<itemColor>DDFDB3</itemColor>
<itemLabel>Jeff Jones</itemLabel>
<itemPhone>666-666-6666</itemPhone>
</ListItem>
<ListItem>
<itemColor>DDFDB3</itemColor>
<itemLabel>Hello</itemLabel>
<itemPhone>666-666-6666</itemPhone>
</ListItem>
</myXMLList>
</XML>
AS3指南參考:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/幾乎與PHP語言一樣清晰:https://secure.php.net/manual/en /index.php 即使AMO PHP參考更高效... – tatactic
php.net充滿了評論和例子。 在Adobe網站上:「評論已被系統管理員禁用」。 S..t :( 在php.net上,你可能會發布例子,等等...... 這有時真的很有幫助 – tatactic
我認爲這是Adobe選擇停止對未來的支持:( 即使他們繼續銷售Flash CC 這是一個可恥的AMO 他們知道閃存的未來,即使他們繼續銷售這種產品! – tatactic