我創建了兩個獨立的類,我想使用我在第二個類中創建的函數的主類中創建的符號。我曾嘗試將兩個類導入對方,但是當我這樣做時,我得到錯誤#1023。我對as3相當陌生,任何幫助都很讚賞,因爲我不知道我做錯了什麼。你如何引用as3中不同類中的符號?
- 謝謝!
public class SuspectSimulatorDesktop extends Sprite {
\t \t [Embed(source="/../lib/SuspectSit.png")]
\t \t private var CharacterSit:Class;
\t \t var tools:Tools = new Tools();
\t \t public var charSit:Bitmap = new CharacterSit();
\t \t public function SuspectSimulatorDesktop() {
\t \t \t
\t \t \t addChild(tools);
}
}
//Tools (Second Class)
package com.powerflasher.SampleApp {
\t import com.powerflasher.SampleApp.SuspectSimulatorDesktop;
\t import flash.events.MouseEvent;
\t import flash.display.Sprite;
\t /**
\t * @author timcis
\t */
\t
\t public class Tools extends Sprite {
\t \t [Embed(source="/../lib/Fist.png")]
\t \t private var Fist:Class;
\t \t var sSim:SuspectSimulatorDesktop = new SuspectSimulatorDesktop();
\t \t private function punchChar(event:MouseEvent):void{
\t \t \t sSim.charSit.rotation = 90;
\t \t }
}
顯示你的代碼。 – BotMaster 2015-03-02 15:56:42