现在的位置: 首页 > 综合 > 正文

Flash+Player+11+Array+Bug

2013年10月12日 ⁄ 综合 ⁄ 共 559字 ⁄ 字号 评论关闭

最近 Flash Player 11 正式版發表不久
網友 Vincent 留言發現空 Array 的 splice 操作會出現問題
測試程式如下

package {

import flash.display.Sprite;

import flash.text.TextField;

import flash.text.TextFormat;

[SWF(width="300", height="200")]

public class Main extends Sprite {

public function Main() {

var txt:TextField = new TextField();

// txt.defaultTextFormat = new TextFormat("Microsoft JhengHei", 16);

txt.defaultTextFormat = new TextFormat("微軟正黑體", 16);

txt.text = "微軟正黑體";

txt.x = 100;

txt.y = 50;

addChild(txt);

}

}

}

輸出結果


WIN 11,0,1,152 StandAlone
[ , , , , ]
[ , , X , , ]
[ , Y , , , ]
[ , Y , Z , , ]

解決方式都寫在註解裡面了,最簡單的方式就是明確指定元素 1 位置的數值
需要注意是,一旦 Array.length 縮減成 0,又重新拉長
就需要再次修正一下 Array

抱歉!评论已关闭.