我有幾個精靈,我試圖通過addChild()組合在一起。 下面是一些僞代碼演示我想完成什麼:AS3:分組精靈
import nav.text.TextSprite;
spr1:Sprite = new Sprite();
spr1.graphics.clear();
spr1.graphics.beginFill(0x000000);
spr1.graphics.drawRect(0,0,100,100);
txt1:TextSprite = new TextSprite;
txt1.text = "hello";
spr1.addChild(txt1);
//this is what isn't working: the sprite is hidden but not the text
spr1.alpha = 0.0;
出於某種原因,我似乎無法得到TextSprite到正確繪製...所有它是與加給它的文本字段雪碧。我認爲所有的東西都在那裏工作,但我可能會遇到一些錯誤,確保所有的TextSprites子項都正確分組。
我應該提到它的位置正確;但是alpha屬性不會以我期望的方式進行響應。 I.E.,TextField附加的精靈將允許設置它的alpha值,但文本保持可見。
有什麼想法?
謝謝。我不知道你必須分開嵌入。你有使用Flash API進行嵌入的參考嗎?我覺得這可能是更直接的Flex嵌入元標記,但我會有興趣學習這兩種方法。 – jml 2010-01-05 16:55:03
我看到這個:http://www.trajiklyhip.com/blog/index.cfm/2007/7/18/Embedding-Fonts-in-Flex,我不太喜歡。我認爲我更喜歡使用嵌入元標記,而不是跳出Flex應用程序來混合。 – jml 2010-01-05 17:08:51
有人可以告訴我,如果這真的是唯一的方法來減小文件大小?我也看到了這一點:http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=performance_118_22.html#227950這可能會有所幫助... – jml 2010-01-05 18:41:58