[問題] 請問如何在Flash IDE內嵌入點陣圖(AS3)

看板Flash作者 (aimai)時間18年前 (2008/02/19 17:14), 編輯推噓2(2013)
留言15則, 3人參與, 最新討論串1/1
現在正在摸索AS3當中,是很新很新的新手 看到書本上有一個範例,是將點陣圖匯入後作色彩反向處理, 如果以Flex發布即可,若是以Flash IDE應該怎麼作呢? 因為如果改以匯入圖片至元件庫,再Export for ActionScipt 則會出現 1119: Access of possibly undefined property ColorTransform through a reference with static type flash.geom:Transform. 若將 pic.transform.ColorTransform.....那行省略 則會出現 TypeError: Error #1007: 嘗試個體化非建構函式。 at TransformColor/::init() 想請教各位先進,如何可以改成IDE版本呢? 感謝^^ 程式碼如下: package{ import flash.display.Bitmap; import flash.display.Sprite; import flash.geom.ColorTransform; public class TransfomColor extends Sprite{ [Embed(source="picture.jpg")] public var Picture:Class; public function TransformColor(){ init(); } private function init():void{ var pic:Bitmap=new Picture(); addChild(pic); pic.transform.ColorTransform=new ColorTransform(-1,-1,-1,-1,255,255,255,0); } } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.168.46.95

02/19 17:44, , 1F
要在library的元件linkage中設定class name
02/19 17:44, 1F

02/19 17:46, , 2F
library>點陣圖上右鍵>linkage>勾選export for AS
02/19 17:46, 2F

02/19 17:46, , 3F
>在class name欄位輸入TransformColor
02/19 17:46, 3F

02/19 17:46, , 4F
然後把[Embed(...]這個metatag整個刪掉
02/19 17:46, 4F

02/19 17:47, , 5F
因為Flash IDE不需要用到這個,也不支援
02/19 17:47, 5F

02/19 17:47, , 6F
打錯,class name應該是Picture才對
02/19 17:47, 6F

02/19 17:51, , 7F
感謝回應,我已經這麼作了但是結果還是會出現1119的錯誤
02/19 17:51, 7F

02/19 17:53, , 8F
請問Base Class是flash.display.BitmapData 是正確的嗎?
02/19 17:53, 8F

02/19 22:25, , 9F
找到錯誤了,ColorTransform的C是小寫...
02/19 22:25, 9F

02/19 22:25, , 10F
注意property名稱開頭是小寫,class name才是大寫
02/19 22:25, 10F

02/20 16:25, , 11F
抱歉>_<"更正後還是會出現#1007: 嘗試個體化非建構函式。
02/20 16:25, 11F

02/20 16:26, , 12F
使用書上作者所附的原始碼也是如此,google後還是不了解
02/20 16:26, 12F

02/20 16:27, , 13F
為什麼會如此??想再次請教原因,非常感謝!!
02/20 16:27, 13F

02/20 16:45, , 14F
附個原始檔如何呢? :)
02/20 16:45, 14F

02/20 16:54, , 15F
http://0rz.tw/123Hr 上傳好了,請取用^^請多指教thanks!
02/20 16:54, 15F
文章代碼(AID): #17kfuAcK (Flash)
文章代碼(AID): #17kfuAcK (Flash)