2009年1月9日星期五

【杂】Flash CS4的ActionScript 3.0中Vector类unshift()方法有Bug

【杂】Flash CS4的ActionScript 3.0中Vector类unshift()方法有Bug——
啸风子 于 2009年1月9日星期五 20:09 发表于 啸风子Flash站点(http://tigerrrflash.blogspot.com/)

----------------------------------------------------------------------

Flash CS4的ActionScript 3.0中Vector类unshift()方法有Bug,用了后,Vector的长度并不能增加,结果导致原有的Vector元素丢失。我怎么都想不到标准库会有Bug,所以这个Bug浪费了我不少调试时间,杀死了不少脑细胞。我上网找了下,只找到一个Adobe上的Bug报告。网址:http://bugs.adobe.com/jira/browse/FP-361。可惜我打不开,通过Google快照的纯文本版本看到的,上面说对String和对象Vector有错误,基本类型能用。引用如下:


Vector.unshift() method removes items at end of vectors of strings and objects when inserting items at the beginning, instead of increasing the length of the vector. Works correctly for vectors of uints.


没有搜到其他人关于此的讨论。也许这个Bug已经被修正?但是我更新Flash CS4后仍然有错误,最后只好用Array代替了。

比如程序为(直接写源程序博客有问题,只好贴图):



输出为:


0
1
2
3
4
5
6
7
8
9


而不是期望的:


0
1,0
2,1,0
3,2,1,0
4,3,2,1,0
5,4,3,2,1,0
6,5,4,3,2,1,0
7,6,5,4,3,2,1,0
8,7,6,5,4,3,2,1,0
9,8,7,6,5,4,3,2,1,0

没有评论:

发表评论