OnEnterFrameBeacon は便利なことこの上ないが、_root の深度 9876 に __OnEnterFrameBeacon という MovieClip が作成される仕様を理解しておきたい。 親 SWF ファイル (MovieClip) が、子 SWF ファイル (MovieClip) を読み込む構成の Flash サイトを構築する際、子の内部で OnEnterFrameBeacon を使用していると、_root である親の方に __OnEnterFrameBeacon が作成される。そのため、子を unloadMovie() や removeMovieClip() で削除しても、子が作成した onEnterFrame() イベントが発生し続けるという問題が起こる。これにより、単体テストで動いてたものが結合テストで急に動かなくなったりと、意外なところで不具合が生じる。 この問
世間が AS3 などで盛り上がってる中、AS2 で恐縮ですが OnEnterFrameBeacon の使い方を ムービークリップの onEnterFrame と比較して書けば使い方が分かりやすそうなので書き残してみる。 onEnterFrame の場合var mc:MovieClip = this.createEmptyMovieClip("enterframe_mc", 1000); mc.onEnterFrame = function() { // 開始 trace("実行"); }; // delete mc.onEnterFrame;//止める OnEnterFrameBeacon の場合import mx.transitions.OnEnterFrameBeacon; OnEnterFrameBeacon.init(); var obj:Object = new Object()
Flash MX 2004およびFlash 8には、OnEnterFrameBeaconというクラスがあります。このクラスのOnEnterFrameBeacon.init()というメソッドを呼出すと、MovieClipにリスナーオブジェクトが登録でき,MovieClip.onEnterFrameイベントを受取れるようになります。 その場合の利点としては、第1にMovieClip以外のオブジェクトを使ったスクリプトで、MovieClipインスタンスをつくらずにMovieClip.onEnterFrameイベントが受取れることです。第2に、複数のfunction(関数)を組合わせてMovieClip.onEnterFrameハンドラで処理をしたいとき、MovieClipインスタンスをいくつも使いたくないという場合も考えられます。本稿では、第1の場合のサンプルスクリプトをご紹介します。 1. O
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く