我正在制作一款游戏,要求学生点击一个给定的状态(显示的单词,如#34; Indiana",他们必须点击状态。在舞台上我有美国的图像,只有国家边界,然后是每个州的50个图像(在#34;状态"阵列中)。每个单独的图像被复制到一个大小与美国国家图像大小相同的透明图像上,在第24张图像投放到舞台上之后,第1张图像消失了。当第25张图像被添加到舞台上时,第2张图像消失了。我不明白为什么。有什么建议吗? (忽略我的错误拼写状态文件名) (Image of USA with missing states)
package
{
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author Brian King
*/
public class Main extends Sprite
{ //states
[Embed(source = "../lib/Alabama.png")]
public var alabamaPic:Class;
[Embed(source = "../lib/Alaska.png")]
public var alaskaPic:Class;
[Embed(source = "../lib/Arizona.png")]
public var arizonaPic:Class;
[Embed(source = "../lib/Arkansas.png")]
public var arkansasPic:Class;
[Embed(source = "../lib/California.png")]
public var californiaPic:Class;
[Embed(source = "../lib/Colorado.png")]
public var coloradoPic:Class;
[Embed(source = "../lib/Connecticut.png")]
public var connecticutPic:Class;
[Embed(source = "../lib/Delaware.png")]
public var delawarePic:Class;
[Embed(source = "../lib/Florida.png")]
public var floridaPic:Class;
[Embed(source = "../lib/Georgia.png")]
public var georgiaPic:Class;
[Embed(source = "../lib/Hawaii.png")]
public var hawaiiPic:Class;
[Embed(source = "../lib/Idaho.png")]
public var idahoPic:Class;
[Embed(source = "../lib/Illnois.png")]
public var illinoisPic:Class;
[Embed(source = "../lib/Indiana.png")]
public var indianaPic:Class;
[Embed(source = "../lib/Iowa.png")]
public var iowaPic:Class;
[Embed(source = "../lib/Kansas.png")]
public var kansasPic:Class;
[Embed(source = "../lib/Kentucky.png")]
public var kentuckyPic:Class;
[Embed(source = "../lib/Loisiana.png")]
public var loisianaPic:Class;
[Embed(source = "../lib/Maine.png")]
public var mainePic:Class;
[Embed(source = "../lib/Maryland.png")]
public var marylandPic:Class;
[Embed(source = "../lib/Massachusetts.png")]
public var massachusettsPic:Class;
[Embed(source = "../lib/Michigan.png")]
public var michiganPic:Class;
[Embed(source = "../lib/Minnesota.png")]
public var minnesotaPic:Class;
[Embed(source = "../lib/Mississippi.png")]
public var mississippiPic:Class;
[Embed(source = "../lib/Missouri.png")]
public var missouriPic:Class;
[Embed(source = "../lib/Nebraska.png")]
public var nebraskaPic:Class;
[Embed(source = "../lib/Nevada.png")]
public var nevadaPic:Class;
[Embed(source = "../lib/NewHampshire.png")]
public var newhapshirePic:Class;
[Embed(source = "../lib/NewJersey.png")]
public var newjerseyPic:Class;
[Embed(source = "../lib/NewMexico.png")]
public var newmexicoPic:Class;
[Embed(source = "../lib/NewYork.png")]
public var newyorkPic:Class;
[Embed(source = "../lib/NorthCarolina.png")]
public var northcarolinaPic:Class;
[Embed(source = "../lib/NorthDakota.png")]
public var northdakotaPic:Class;
[Embed(source = "../lib/Ohio.png")]
public var ohioPic:Class;
[Embed(source = "../lib/Oklahoma.png")]
public var oklahomaPic:Class;
[Embed(source = "../lib/Oregon.png")]
public var oregonPic:Class;
[Embed(source = "../lib/Pennsylvania.png")]
public var pennsylvaniaPic:Class;
[Embed(source = "../lib/RhodeIsland.png")]
public var rhodeIslandPic:Class;
[Embed(source = "../lib/SouthCarolina.png")]
public var southcarolinaPic:Class;
[Embed(source = "../lib/SouthDekota.png")]
public var southdadotaPic:Class;
[Embed(source = "../lib/Tennessee.png")]
public var tennesseePic:Class;
[Embed(source = "../lib/Texas.png")]
public var texasPic:Class;
[Embed(source = "../lib/Utah.png")]
public var utahPic:Class;
[Embed(source = "../lib/Vermont.png")]
public var vermontPic:Class;
[Embed(source = "../lib/Virginia.png")]
public var virginiaPic:Class;
[Embed(source = "../lib/Washington.png")]
public var washingtonPic:Class;
[Embed(source = "../lib/WestVirginia.png")]
public var westvirginiaPic:Class;
[Embed(source="../lib/Wisconsin.png")]
public var wisconsinPic:Class;
[Embed(source = "../lib/Montana.png")]
public var montanaPic:Class;
[Embed(source = "../lib/Wyoming.png")]
public var wyomingPic:Class;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var state:Array = new Array();
state.push(new alabamaPic());
state.push(new alaskaPic());
state.push(new arizonaPic());
state.push(new arkansasPic());
state.push(new californiaPic());
state.push(new coloradoPic());
state.push(new connecticutPic());
state.push(new delawarePic());
state.push(new floridaPic());
state.push(new georgiaPic());
state.push(new hawaiiPic());
state.push(new idahoPic());
state.push(new illinoisPic());
state.push(new indianaPic());
state.push(new iowaPic());
state.push(new kansasPic());
state.push(new kentuckyPic());
state.push(new loisianaPic());
state.push(new mainePic());
state.push(new marylandPic());
state.push(new massachusettsPic());
state.push(new michiganPic());
state.push(new minnesotaPic());
state.push(new mississippiPic());
state.push(new missouriPic());
state.push(new montanaPic());
state.push(new nebraskaPic());
state.push(new nevadaPic());
state.push(new newhapshirePic());
state.push(new newjerseyPic());
state.push(new newmexicoPic());
state.push(new newyorkPic());
state.push(new northcarolinaPic());
state.push(new northdakotaPic());
state.push(new ohioPic());
state.push(new oklahomaPic());
state.push(new oregonPic());
state.push(new pennsylvaniaPic());
state.push(new rhodeIslandPic());
state.push(new southcarolinaPic());
state.push(new southdadotaPic());
state.push(new tennesseePic());
state.push(new texasPic());
state.push(new utahPic());
state.push(new vermontPic());
state.push(new virginiaPic());
state.push(new washingtonPic());
state.push(new westvirginiaPic());
state.push(new wisconsinPic());
state.push(new wyomingPic());
var counter:int = 0;
counter = 0;
while (counter < 50) {
addChild(state[counter]);
counter++;
}
}
}
}