这绝对不行。 for循环只是垃圾邮件跟踪字典中的一个对象。在10秒后,我收到此错误消息:
错误:错误#1502:脚本的执行时间超过了15秒的默认超时时间。
有谁知道为什么?
package
{
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.display.Sprite;
public class Main extends MovieClip
{
public static var bg_width = 980;
public static var bg_height = 541;
public var S_Norway:Dictionary = new Dictionary();
public var S_Australia:Dictionary = new Dictionary();
public var S_China:Dictionary = new Dictionary();
public var S_South_Africa:Dictionary = new Dictionary();
public var S_Brazil:Dictionary = new Dictionary();
public var S_USA:Dictionary = new Dictionary();
public var S_France:Dictionary = new Dictionary();
// ------------------------------------------------------
public static var airportDict:Dictionary = new Dictionary();
public function Main()
{
S_USA["x"] = -299;
S_USA["y"] = -114;
S_USA["city"] = "New York";
S_Norway["x"] = -60;
S_Norway["y"] = -183;
S_Norway["city"] = "Oslo";
S_South_Africa["x"] = -26;
S_South_Africa["y"] = 146;
S_South_Africa["city"] = "Cape Town";
S_Brazil["x"] = -210;
S_Brazil["y"] = 73;
S_Brazil["city"] = "Rio de Janeiro";
S_France["x"] = -79;
S_France["y"] = -135;
S_France["city"] = "Paris";
S_China["x"] = 239;
S_China["y"] = -98;
S_China["city"] = "Beijing";
S_Australia["x"] = 307;
S_Australia["y"] = 153;
S_Australia["city"] = "Sydney";
airportDict["USA"] = S_USA;
airportDict["Norway"] = S_Norway;
airportDict["South Africa"] = S_South_Africa;
airportDict["Brazil"] = S_Brazil;
airportDict["France"] = S_France;
airportDict["China"] = S_China;
airportDict["Australia"] = S_Australia;
for (var k:Object in airportDict)
{
var value = airportDict[k];
var key = k;
trace(key);
var airport:flyplass = new flyplass(key,airportDict[key]["bynavn"]);
airport.coordinates(airportDict[key]["x"], airportDict[key]["y"]);
this.addChild(airport);
}
在调试模式下运行脚本(CTRL - SHIFT - Enter)会产生以下输出。
尝试使用网址C:\ Users \ eivmey \ Documents \ practice \ 3.0.swf启动并连接到播放器 [SWF] C:\ Users \ eivmey \ Documents \ It 2 \ fly \ 3.0.swf - 解压后475976字节
美国 澳大利亚 *澳大利亚的无限垃圾邮件如下:
的 的 __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ _ -
编辑:解决了它
好的,问题出在flyplass类。
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.SimpleButton;
import flash.display.Stage;
import flash.text.TextField;
import flash.text.TextFormat;
public class flyplass extends Main()
{
// variables
public function flyplass(input1, input2)
{
// code
}
将extends Main()
更改为extends MovieClip
时突然有效。你知道为什么吗?