Flash CS3 ドキュメンテーション |
|||
| ActionScript 3.0 のプログラミング > ActionScript の使用について > オブジェクトの操作 > イベント > イベント処理の例 | |||
ここでは、イベント処理コードの作成時に使用できる共通のイベント要素および可能なバリエーションのいくつかを発想するのに役立つ、いくつかのより具体的なイベント例について説明します。
playButton はボタンのインスタンス名であり、this は "現在のオブジェクト" を意味する特別な名前です。
this.stop();
function playMovie(event:MouseEvent):void
{
this.play();
}
playButton.addEventListener(MouseEvent.CLICK, playMovie);
entryText はテキスト入力フィールド、outputText はダイナミックテキストフィールドです。
function updateOutput(event:TextEvent):void
{
var pressedKey:String = event.text;
outputText.text = "You typed: " + pressedKey;
}
entryText.addEventListener(TextEvent.TEXT_INPUT, updateOutput);
linkButton はボタンのインスタンス名です。
function gotoAdobeSite(event:MouseEvent):void
{
var adobeURL:URLRequest = new URLRequest("http://www.adobe.com/");
navigateToURL(adobeURL);
}
linkButton.addEventListener(MouseEvent.CLICK, gotoAdobeSite);
このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート
現在のページ: http://livedocs.adobe.com/flash/9.0_jp/main/00000023.html