Re: [問題] 出現的問題

看板Flash作者 (真的累了)時間17年前 (2009/02/02 16:04), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
XDDDDDDDDDDD 一個解決後又一個問題 X:10 Y:10 0 ReferenceError: Error #1069: builtin.as$0.MethodClosure 上找不到屬性 circle5, 而且沒有預設值。 at _fla::MainTimeline/count() at _fla::MainTimeline/container2EnterFrameHandler() 不大懂~"~ ※ 引述《pk9527108 (真的累了)》之銘言: : 各位好 : 以下先呈現程式碼 : 由於我算是代po的 : 所以只能先呈現目前程式碼 : 稍後描述問題 : import flash.display.Sprite; : var container1:Sprite = new Sprite(); : container1.x=250; : container1.y=180; : var container2:Sprite = new Sprite(); : addChild(container2); : //紅 : var circle1:Sprite = new Sprite(); : circle1.graphics.beginFill(0xFF0000); : circle1.graphics.drawRect(-50, -50, 100,100); : circle1.z=-50; : //綠 : var circle2:Sprite = new Sprite(); : circle2.graphics.beginFill(0x00FF00); : circle2.graphics.drawRect(-50, -50, 100,100); : circle2.x=50; : circle2.rotationY=-90; : //黃 : var circle3:Sprite = new Sprite(); : circle3.graphics.beginFill(0xFFFF33); : circle3.graphics.drawRect(-50, -50, 100,100); : circle3.z=50; : //藍 : var circle4:Sprite = new Sprite(); : circle4.graphics.beginFill(0x0000CC); : circle4.graphics.drawRect(-50, -50, 100,100); : circle4.z=0; : circle4.x=-50; : circle4.rotationY=-90; : //紫色 : var circle5:Sprite = new Sprite(); : circle5.graphics.beginFill(0xCC00FF); : circle5.graphics.drawRect(-50, -50, 100,100); : circle5.y=-50; : circle5.rotationX=90; : //桃紅 : var circle6:Sprite = new Sprite(); : circle6.graphics.beginFill(0xFF00FF); : circle6.graphics.drawRect(-50, -50, 100,100); : circle6.y=50; : circle6.rotationX=90; : container2.addChild(container1); : container1.addChild(circle6); : container1.addChild(circle4); : container1.addChild(circle3); : container1.addChild(circle2); : container1.addChild(circle5); : container1.addChild(circle1); : var t:Boolean=false; : container2.addEventListener(MouseEvent.MOUSE_DOWN, : container2EnterFrameHandler); : var num:Array=new Array("5","1","2",//1 : "3","5","2",//2 : "5","4","3",//3 : "5","4","1",//4 : "1","6","2",//5 : "6","2","3",//6 : "4","6","3",//7 : "4","6","1");//8 : var i:Number=0; : function container2EnterFrameHandler(event:MouseEvent):void{ : /*if(t==false){ : trace("測"); : t=true; : //container1.swapChildrenAt(3,1); : container1.swapChildrenAt(2,0); : }*/ : container1.rotationY+=10; : container1.rotationX+=10; : trace("X:"+ container1.rotationY); : trace("Y:"+container1.rotationX); : trace(Math.floor(container1.rotationY %360/90)); : switch(Math.floor(container1.rotationY %360/90)){ : case 0: : switch(Math.floor(container1.rotationX %360/90)){ : case 0: : count(1); : break; : case 1: : count(2); : break; : case 2: : count(3); : break; : case 3: : count(4); : break; : } : break; : case 1: : switch(Math.floor(container1.rotationX %360/90)){ : case 0: : count(2); : break; : case 1: : count(6); : break; : case 2: : count(7); : break; : case 3: : count(3); : break; : } : break; : case 2: : switch(Math.floor(container1.rotationX %360/90)){ : case 0: : count(6); : break; : case 1: : count(5); : break; : case 2: : count(8); : break; : case 3: : count(7); : break; : } : break; : case 3: : switch(Math.floor(container1.rotationX %360/90)){ : case 0: : count(5); : break; : case 1: : count(1); : break; : case 2: : count(4); : break; : case 3: : count(8); : break; : } : break; : } : } : function count(c:Number):void{ : for(var t=0 ; t<6 ; t++) : container1.removeChildAt(0); : container1.addChild(circle+"num[(c-1)*3]"); : container1.addChild(circle+"num[(c-1)*3+1]"); : container1.addChild(circle+"num[(c-1)*3+2]"); : } : 接著就是想請教的問題 : 在最後一段程式當中 : 也就是 : 最下面 那 container1.addChild(circle+"num[(c-1)*3]"); : container1.addChild(circle+"num[(c-1)*3+1]"); : container1.addChild(circle+"num[(c-1)*3+2]"); : 出現了以下問題: : 1120: 存取未定義的屬性 circle。 : 1067: String 類型值以隱含方式強制轉型成不相關的類型 : flash.display:DisplayObject。 : 1120: 存取未定義的屬性 circle。 : 1067: String 類型值以隱含方式強制轉型成不相關的類型 : flash.display:DisplayObject。 : 1120: 存取未定義的屬性 circle。 : 1067: String 類型值以隱含方式強制轉型成不相關的類型 : flash.display:DisplayObject。 : 想請教一下如何改善呢 : 備註:本程式碼是用AS3.0撰寫 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.198.172.92
文章代碼(AID): #19XgaDH9 (Flash)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
文章代碼(AID): #19XgaDH9 (Flash)