2006年7月30日 星期日

FMS Server-Side ActionScript 怪異的列舉行為   [+/-]

Ticore's Blog

FMS Server-Side ActionScript 怪異的列舉行為
大概是因為效能考量
String 的實作方式改了吧
SSAS Code:
var str = "1234";
for (var i in str) {
  trace("str[" + i + "] : " + str[i]);
}
output:
str[0] : 1
str[1] : 2
str[2] : 3
str[3] : 4
Read more...

2006年7月27日 星期四

NetConnection.onStatus Bug   [+/-]

Ticore's Blog

Bug 又來了~~
這次是 NetConnection 的 onStatus 事件
當使用 AS2 NetConnection.call 呼叫 Remtoing 方法時
假如呼叫失敗 onStatus 事件 可以取得 一個 infoObject 的錯誤資訊
但是在 Flash 8、9 Player,該 infoObject 內的資料卻不見了

ActionScript 2.0:
var nc:NetConnection = new NetConnection();
var url:String = "http://localhost:8080/";
nc.onStatus = function(infoObj:Object) {
 trace("onStatus : " + infoObj);
 for (var i in infoObj) {
  trace("infoObj[" + i + "] : " + infoObj[i]);
 }
};
nc.connect(url);
nc.call("test", null);

Flash Player 8 output:
Error opening URL "http://localhost:8080/"
onStatus : undefined

Flash Player 7 output:
Error opening URL "http://localhost:8080/"
onStatus : undefined
infoObj[details] : http://localhost:8080/
infoObj[description] : HTTP: Failed
infoObj[code] : NetConnection.Call.Failed
infoObj[level] : error

以上的 Bug 至少會發生在以下版本的 Flash Player:
Flash Player 7.0.69.0
Flash Player 8.0.34.0
Flash Player 9.0.115.0
Flash Player 9.0.124.0
Flash Player 10.0.0.525
Flash Player 10.0.1.218
Flash Player 10.0.12.10

Read more...

2006年7月26日 星期三

快速活化所有 IE ActiveX Object   [+/-]

Ticore's Blog

相信大家對 IE ActiveX 更新都很 OOXX
解決方式也有不少
但是從此以後製作網頁上的 Flash 都變得更複雜
在此提供一個簡單而且通用的做法
只要在網頁加入一行外部 JS
就可以將該網頁內所有的 ActiveX 全部活化

activeObject.js:

document.body.innerHTML = document.body.innerHTML;

在 HTML body 後面加上:

<script src="activeObject.js" type="text/javascript" language="javascript"></script>

2006/08/06
activeObject.js 的內容可以再更簡化一些

document.body.innerHTML += "";
Read more...

2006年7月4日 星期二

Flash Player 9 Sprite 交換階層 Bug   [+/-]

Ticore's Blog

Flash Player 9 & AS 3.0 有一個重要的特色

幾乎全部的 display object 都可以用程式產生
也可以將 display object 自由的放在不同層級 (並非指深度 depth)

假設已建立 Sprite 階層如下:

 root
 └sp1
  └sp2

可以用程式交換 sp1、sp2 變成這樣:

 root
 └sp2
  └sp1

需要兩個步驟

 root.addChild(sp2);
 sp2.addChild(sp1);

假如少了第一個步驟 直接執行

 sp2.addChild(sp1);


將會造成 Flash Player 9 Crash

import flash.display.*;
var sp1:Sprite = new Sprite();
var sp2:Sprite = new Sprite();
sp1.x = 50;
sp1.y = 50;
sp2.x = 50;
sp2.y = 25;

sp1.graphics.lineStyle(1, 0x999999, 1);
sp2.graphics.lineStyle(1, 0x999999, 1);
sp1.graphics.beginFill(0x999999, 0.5);
sp2.graphics.beginFill(0x999999, 0.5);
sp1.graphics.drawRect(0, 0, 200, 100);
sp2.graphics.drawRect(0, 0, 100, 50);

this.addChild(sp1);
sp1.addChild(sp2);

//this.addChild(sp2);
sp2.addChild(sp1);


2007/06/09 更新
Flash Player 9.0.45.0 或是較新版本似乎已經對此 Bug 做了修正
上述的程式會丟出 Error
ArgumentError: Error #2150: 不能將物件當作自身子系的其中一個子系加入 (或是自身子系的子系)。
 at flash.display::DisplayObjectContainer/addChild()
 at Untitled_fla::MainTimeline/Untitled_fla::frame1()
Read more...

FMS NetStream.publish 小問題   [+/-]

Ticore's Blog

測試 Flash AS NetStream、FMS Server 錄影的時候
發現 NetStream.publish 有一個小問題

public publish(name : String [, howToPublish : String] ) : Void

串流的名稱不可以是數字型別
否則發布串流會失效
要先將數字轉型成為字串

Read more...