[問題] 把兩個as檔合併的問題

看板Flash作者 (11111)時間14年前 (2010/03/31 19:36), 編輯推噓2(205)
留言7則, 4人參與, 最新討論串1/1
以下是程式碼 package { import flash.display.Sprite; import org.papervision3d.objects.parsers.DAE; [SWF(width=640, height=480, backgroundColor=0x0, frameRate=30)] public class Gihyo2_1a extends PV3DARApp { private var _miku:DAE; public function Gihyo2_1a() { this.init('Data/camera_para.dat', 'Data/flarlogo.pat'); } protected override function onInit():void { super.onInit(); this._miku = new DAE(); this._miku.load('negimiku.dae'); this._baseNode.addChild(this._miku); } } import flash.display.*; import flash.net.*; import com.adobe.serialization.json.JSON; public class MyData extends MovieClip { private var nc:NetConnection; private var rs:Responder; public function MyData() { var hd:HttpDomain = new HttpDomain(this); var gateway:String = hd.domain + "/flash_php_ch07/amfphp/gateway.php"; nc = new NetConnection(); nc.connect( gateway ); rs = new Responder(testResult, testFault); nc.call('chkDB.DBtest', rs); } private function testResult(result:*):void { trace( JSON.encode(result) ); } private function testFault(fault:Object):void { trace('Fault:' + JSON.encode(fault) ); } } } 會出現錯誤 5006: ActionScript 檔不能有超過一個以上的外部可見定義: Gihyo2_1a, MyData 新手 感謝回答 -- 你好帥 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.43.36.79

03/31 21:02, , 1F
不能有超過一個以上的外部可見定義 <-- 不是寫了嗎?
03/31 21:02, 1F

03/31 21:02, , 2F
程式碼不是剪下貼上就行的..-_-
03/31 21:02, 2F

03/31 21:33, , 3F
你需要的是基礎 先把手上的amfphp教材丟一邊吧
03/31 21:33, 3F

04/01 00:36, , 4F
同package不能有兩個public class, 可以試著把第二個放
04/01 00:36, 4F

04/01 00:37, , 5F
到package外,namespace全寫.. 不過建議還是分兩個檔吧.
04/01 00:37, 5F

04/01 00:40, , 6F
新手import問題 可以試著使用FlashDevelop等IDE自動補完
04/01 00:40, 6F

04/01 21:59, , 7F
你說我帥嗎XD
04/01 21:59, 7F
文章代碼(AID): #1BipF749 (Flash)