1
問題是,我每次嘗試繼續下一個場景時,它都不會刪除孩子。我想這樣做,當櫃檯去 4它會把它拿出來,並在一個新的場景。有沒有辦法解決這個問題?我不明白如何切換場景錯誤#2025:編程中的ActionScript問題
我正在創建一個遊戲,並且出現此錯誤: ArgumentError:錯誤#2025:提供的DisplayObject必須是調用者的子項。 在flash.display一::級DisplayObjectContainer/removeChild之() 在亞軍/的onEnterFrame()
package {
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
public class Runner extends MovieClip {
public var startPage:StartPage = new StartPage();
public var backStory1:BackStory1 = new BackStory1();
public var water:Water = new Water();
public function Runner() {
addChild(startPage);
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
function onEnterFrame(event:Event):void{
if(startPage.endStartPage == true){
removeChild(startPage);
addChild(backStory1);
startPage.endStartPage == false;
}
if(backStory1.backStory1End == true){ //in backstory1 the bool backstory1end is suppose to be true but it doesnt get to that point
removeChild(backStory1);
addChild(water);
startPage.endStartPage == false;
}
}
}
}
背景故事類
package {
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
public class BackStory1 extends MovieClip {
var backStory1End:Boolean = false;
var count:int = 0;
public function BackStory1() {
backStory1Text.text = "sssherro";
if (stage)
{
init(null);
}
else
{
addEventListener(Event.ADDED_TO_STAGE,init);
}
function init(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
nextButton.addEventListener(MouseEvent.MOUSE_DOWN,onButtonClick);
}
function onButtonClick(event:MouseEvent):void{
count++;
if(count == 1){
backStory1Text.text = "awesome1";
//backStory1End= true;
}
else if(count == 2){
backStory1Text.text = "awesome2";
}
else if(count == 3){
backStory1Text.text = "awesome3 leave game press";
}
else if(count == 4){
//backStory1Text.text = (String)(counter);
backStory1End = true;
}
}
}
}
}
你能提供你在這裏做什麼更多的信息,你希望完成什麼,你已經嘗試過,你就不清楚?這些答案通常沒有得到太多的關注,因爲它們幾乎沒有解釋,所以解決的問題還不清楚。 – 2013-11-21 02:31:15