« MouseWheel on Mac(JP) | Main | flash_proxy PART1(JP) »

AS2 to AS3 migration(JP)

たまに使うコマンドの変更点の列挙。

asfunction
asfunctionはAS3には無く、eventDispatcherで処理する。eventを発生させたいtext箇所にevent:文字列を埋め込む。

field.htmlText="<a href='event:login'>click to login</a>";
addEventListener(TextEvent.LINK, onLinkEvent);
function onLinkEvent(evt:TextEvent):void{
  trace(evt.text);//login
}

updateAfterEvent()
強制再描画関数はもうグローバル関数ではない。timer、mouse、keyboardのイベントクラスから呼び出せる。

instanceof
全オブジェクトをループで列挙しながら特定の型を確認するケースはまれにあるが、今後はisを使う。

for(var i in this){
  if(this[i] is Sprite){
    trace("SPRITE");
  }
}

Comments

It's a very nice website you're having here. international, lazy, international nothing comparative to beautiful

Post a comment