看板 Flash 關於我們 聯絡資訊
現在正在摸索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
cjcat2266:要在library的元件linkage中設定class name 02/19 17:44
cjcat2266:library>點陣圖上右鍵>linkage>勾選export for AS 02/19 17:46
cjcat2266: >在class name欄位輸入TransformColor 02/19 17:46
cjcat2266:然後把[Embed(...]這個metatag整個刪掉 02/19 17:46
cjcat2266:因為Flash IDE不需要用到這個,也不支援 02/19 17:47
cjcat2266:打錯,class name應該是Picture才對 02/19 17:47
twishine:感謝回應,我已經這麼作了但是結果還是會出現1119的錯誤 02/19 17:51
twishine:請問Base Class是flash.display.BitmapData 是正確的嗎? 02/19 17:53
cjcat2266:找到錯誤了,ColorTransform的C是小寫... 02/19 22:25
cjcat2266:注意property名稱開頭是小寫,class name才是大寫 02/19 22:25
twishine:抱歉>_<"更正後還是會出現#1007: 嘗試個體化非建構函式。 02/20 16:25
twishine:使用書上作者所附的原始碼也是如此,google後還是不了解 02/20 16:26
twishine:為什麼會如此??想再次請教原因,非常感謝!! 02/20 16:27
aquarianboy:附個原始檔如何呢? :) 02/20 16:45
twishine:http://0rz.tw/123Hr 上傳好了,請取用^^請多指教thanks! 02/20 16:54