パッケージflash.events
クラスpublic class ProgressEvent
継承ProgressEvent Inheritance Event Inheritance Object
サブクラス VideoProgressEvent

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

ロード操作が開始されるか、ソケットがデータを受信すると、Flash® Player によって ProgressEvent オブジェクトが送出されます。これらのイベントは、通常、SWF ファイル、イメージ、またはデータが Flash Player にロードされるときに生成されます。次の 2 種類のキーボードイベントがあります。ProgressEvent.PROGRESS および ProgressEvent.SOCKET_DATA

例を表示

関連項目

LoaderInfo クラス
Socket クラス


パブリック プロパティ
 プロパティ定義元
 Inheritedbubbles : Boolean
[read-only] イベントがバブリングイベントかどうかを示します。
Event
  bytesLoaded : uint
リスナーがイベントを処理しているときにロードされたアイテム数またはバイト数です。
ProgressEvent
  bytesTotal : uint
ロードプロセスが成功した場合にロードされるアイテムまたはバイトの総数です。
ProgressEvent
 Inheritedcancelable : Boolean
[read-only] イベントに関連付けられた動作を回避できるかどうかを示します。
Event
 Inheritedconstructor : Object
特定のオブジェクトインスタンスのクラスオブジェクトまたはコンストラクタ関数への参照です。
Object
 InheritedcurrentTarget : Object
[read-only] イベントリスナーで Event オブジェクトをアクティブに処理しているオブジェクトです。
Event
 InheritedeventPhase : uint
[read-only] イベントフローの現在の段階です。
Event
 Inheritedprototype : Object
[static] クラスまたは関数オブジェクトのプロトタイプオブジェクトへの参照です。
Object
 Inheritedtarget : Object
[read-only] イベントターゲットです。
Event
 Inheritedtype : String
[read-only] イベントのタイプです。
Event
パブリック メソッド
 メソッド定義元
  
ProgressEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, bytesLoaded:uint = 0, bytesTotal:uint = 0)
progress イベントに関する情報を含む Event オブジェクトを作成します。
ProgressEvent
  
ProgressEvent オブジェクトのコピーを作成して、各プロパティの値を元のプロパティの値と一致するように設定します。
ProgressEvent
 Inherited
formatToString(className:String, ... arguments):String
カスタム Event クラスに toString() メソッドを実装するためのユーティリティ関数です。
Event
 Inherited
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inherited
イベントで preventDefault() が呼び出されたかどうかを確認します。
Event
 Inherited
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
 Inherited
イベントのデフォルトの動作をキャンセルできる場合に、その動作をキャンセルします。
Event
 Inherited
指定されたプロパティが存在し列挙できるかどうかを示します。
Object
 Inherited
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
 Inherited
イベントフローの現在のノードおよび後続するノードで、イベントリスナーが処理されないようにします。
Event
 Inherited
イベントフローの現在のノードに後続するノードで、イベントリスナーが処理されないようにします。
Event
  
ProgressEvent オブジェクトのすべてのプロパティを含むストリングを返します。
ProgressEvent
 Inherited
指定されたオブジェクトのプリミティブな値を返します。
Object
パブリック 定数
 定数定義元
 InheritedACTIVATE : String = "activate"
[static] activate イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedADDED : String = "added"
[static] added イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedADDED_TO_STAGE : String = "addedToStage"
[static] addedToStage イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedCANCEL : String = "cancel"
[static] cancel イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedCHANGE : String = "change"
[static] change イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedCLOSE : String = "close"
[static] close イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedCOMPLETE : String = "complete"
[static] complete イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedCONNECT : String = "connect"
[static] connect イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedDEACTIVATE : String = "deactivate"
[static] deactivate イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedENTER_FRAME : String = "enterFrame"
[static] enterFrame イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedFULLSCREEN : String = "fullScreen"
[static] fullScreen イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedID3 : String = "id3"
[static] id3 イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedINIT : String = "init"
[static] init イベントオブジェクトの type プロパティの値を定義します。
Event
 InheritedMOUSE_LEAVE : String = "mouseLeave"
[static] mouseLeave イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedOPEN : String = "open"
[static] open イベントオブジェクトの type プロパティ値を定義します。
Event
  PROGRESS : String = "progress"
[static] progress イベントオブジェクトの type プロパティ値を定義します。
ProgressEvent
 InheritedREMOVED : String = "removed"
[static] removed イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedREMOVED_FROM_STAGE : String = "removedFromStage"
[static] removedFromStage イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedRENDER : String = "render"
[static] render イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedRESIZE : String = "resize"
[static] resize イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedSCROLL : String = "scroll"
[static] scroll イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedSELECT : String = "select"
[static] select イベントオブジェクトの type プロパティ値を定義します。
Event
  SOCKET_DATA : String = "socketData"
[static] socketData イベントオブジェクトの type プロパティ値を定義します。
ProgressEvent
 InheritedSOUND_COMPLETE : String = "soundComplete"
[static] soundComplete イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedTAB_CHILDREN_CHANGE : String = "tabChildrenChange"
[static] tabChildrenChange イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedTAB_ENABLED_CHANGE : String = "tabEnabledChange"
[static] tabEnabledChange イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedTAB_INDEX_CHANGE : String = "tabIndexChange"
[static] tabIndexChange イベントオブジェクトの type プロパティ値を定義します。
Event
 InheritedUNLOAD : String = "unload"
[static] unload イベントオブジェクトの type プロパティ値を定義します。
Event
プロパティの詳細
bytesLoadedプロパティ
bytesLoaded:uint  [read-write]

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

リスナーがイベントを処理しているときにロードされたアイテム数またはバイト数です。


実装
    public function get bytesLoaded():uint
    public function set bytesLoaded(value:uint):void
bytesTotalプロパティ 
bytesTotal:uint  [read-write]

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

ロードプロセスが成功した場合にロードされるアイテムまたはバイトの総数です。


実装
    public function get bytesTotal():uint
    public function set bytesTotal(value:uint):void
コンストラクタの詳細
ProgressEvent()コンストラクタ
public function ProgressEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, bytesLoaded:uint = 0, bytesTotal:uint = 0)

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

progress イベントに関する情報を含む Event オブジェクトを作成します。イベントリスナーには Event オブジェクトがパラメータとして渡されます。

パラメータ
type:String — イベントのタイプです。有効な値は次のとおりです。ProgressEvent.PROGRESS および ProgressEvent.SOCKET_DATA
 
bubbles:Boolean (default = false) — Event オブジェクトがイベントフローのバブリング段階で処理されるかどうかを判断します。
 
cancelable:Boolean (default = false) — Event オブジェクトがキャンセル可能かどうかを判断します。
 
bytesLoaded:uint (default = 0) — リスナーがイベントを処理しているときにロードされたアイテム数またはバイト数です。
 
bytesTotal:uint (default = 0) — ロードプロセスが成功した場合にロードされるアイテムまたはバイトの総数です。
メソッドの詳細
clone()メソッド
public override function clone():Event

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

ProgressEvent オブジェクトのコピーを作成して、各プロパティの値を元のプロパティの値と一致するように設定します。

戻り値
Event — 元のオブジェクトと同じプロパティ値を含む新しい ProgressEvent オブジェクトです。
toString()メソッド 
public override function toString():String

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

ProgressEvent オブジェクトのすべてのプロパティを含むストリングを返します。ストリングは次の形式です。

[ProgressEvent type=value bubbles=value cancelable=value bytesLoaded=value bytesTotal=value]

戻り値
StringProgressEvent オブジェクトのすべてのプロパティを含むストリングです。
定数の詳細
PROGRESS定数
public static const PROGRESS:String = "progress"

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

type プロパティ (progress イベントオブジェクト) の値を定義します。

このイベントには、次のプロパティがあります。

プロパティ
bubblesfalse
bytesLoadedリスナーがイベントを処理しているときにロードされたアイテム数またはバイト数です。
bytesTotalロードプロセスが成功した場合に最終的にロードされるアイテムまたはバイトの総数です。
cancelablefalse は、キャンセルするデフォルトの動作がないことを示します。
currentTargetイベントリスナーで Event オブジェクトをアクティブに処理しているオブジェクトです。
target進行状況をレポートするネットワークオブジェクトです。

関連項目

SOCKET_DATA定数 
public static const SOCKET_DATA:String = "socketData"

言語バージョン : ActionScript 3.0
Player のバージョン : Flash Player 9

type プロパティ (socketData イベントオブジェクト) の値を定義します。

このイベントには、次のプロパティがあります。

プロパティ
bubblesfalse
cancelablefalse は、キャンセルするデフォルトの動作がないことを示します。
currentTargetEvent をアクティブに処理しているオブジェクトです。
bytesLoadedリスナーがイベントを処理しているときにロードされたアイテム数またはバイト数です。
bytesTotal0 は、このプロパティが socketData イベントオブジェクトによって使用されないことを示します。
target進行状況をレポートする Socket オブジェクトです。

関連項目

例の使用法
ProgressEventExample.as

次の例では、ProgressEventExample クラスを使用して、ファイルのダウンロード中にさまざまなイベントリスナーを使用する方法を示します。この例では、次の処理を実行します。
  1. downloadURLfileName という 2 つのプロパティが作成されます。このプロパティは、ダウンロードされたファイルの場所と名前を示します。
  2. ProgressEventExample コンストラクタでは、file という名前の新しい FileReference オブジェクトが作成され、configureListeners() メソッドに渡されます。
  3. 次に、downloadURL プロパティと fileName プロパティが file.download() に渡されます。これによって、ファイルをダウンロードする場所の指定が求められます。
  4. configureListeners() メソッドは、7 つのイベントリスナーとそれに関連するサブスクライバメソッドを追加します。
    1. cancel/cancelHandler() は、ファイルのダウンロードがキャンセルされた場合に送出されます。
    2. complete / complereHandler() は、ファイルのダウンロードプロセスが終了したときに送出されます。
    3. ioError/ioErrorHandler() は、ダウンロードファイルが使用できない場合、またはアクセスできない場合に送出されます。
    4. open/openHandler() は、ダウンロード操作が開始したときに送出されます。
    5. progress/progressHandler() は、ダウンロードプロセスが開始したときと終了したときに送出されます。
    6. securityError/securityErrorHandler は、ローカル再生のセキュリティ設定がダウンロードファイル (ローカル対ネットワーク) のデータアクセスの種類と一致しない場合に送出されます。この後の「メモ」を参照してください。
    7. select/selectHandler() は、ダウンロードオブジェクトが選択されたときに送出されます。

メモ :


package {
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.FileReference;
    import flash.net.URLRequest;

    public class ProgressEventExample extends Sprite {
        private var downloadURL:String = "http://www.[yourDomain].com/SomeFile.pdf";
        private var fileName:String = "SomeFile.pdf";
        private var file:FileReference;

        public function ProgressEventExample() {
            var request:URLRequest = new URLRequest(downloadURL);
            file = new FileReference();
            configureListeners(file);
            file.download(request, fileName);
        }

        private function configureListeners(dispatcher:IEventDispatcher):void {
            dispatcher.addEventListener(Event.CANCEL, cancelHandler);
            dispatcher.addEventListener(Event.COMPLETE, completeHandler);
            dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
            dispatcher.addEventListener(Event.OPEN, openHandler);
            dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            dispatcher.addEventListener(Event.SELECT, selectHandler);
        }

        private function cancelHandler(event:Event):void {
            trace("cancelHandler: " + event);
        }

        private function completeHandler(event:Event):void {
            trace("completeHandler: " + event);
        }

        private function ioErrorHandler(event:IOErrorEvent):void {
            trace("ioErrorHandler: " + event);
        }

        private function openHandler(event:Event):void {
            trace("openHandler: " + event);
        }

        private function progressHandler(event:ProgressEvent):void {
            var file:FileReference = FileReference(event.target);
            trace("progressHandler: name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
        }

        private function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }

        private function selectHandler(event:Event):void {
            var file:FileReference = FileReference(event.target);
            trace("selectHandler: name=" + file.name + " URL=" + downloadURL);
        }
    }
}




 

このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート

現在のページ: http://livedocs.adobe.com/flash/9.0_jp/ActionScriptLangRefV3/flash/events/ProgressEvent.html