fl.events
public class ScrollEvent
继承ScrollEvent Inheritance Event Inheritance Object

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

ScrollEvent 类定义与 ScrollBar 组件关联的滚动事件。

另请参见

ScrollBar
ScrollBarDirection
UIComponent



公共 属性
 属性定义方
 Inheritedbubbles : Boolean
[read-only] 指示事件是否为冒泡事件。
Event
 Inheritedcancelable : Boolean
[read-only] 指示是否可以阻止与事件相关联的行为。
Event
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
 InheritedcurrentTarget : Object
[read-only] 当前正在使用某个事件侦听器处理 Event 对象的对象。
Event
  delta : Number
[read-only] 获取滚动位置的更改大小(以像素为单位)。
ScrollEvent
  direction : String
[read-only] 获取一个常数值,该值指示与事件关联的移动方向。
ScrollEvent
 InheritedeventPhase : uint
[read-only] 事件流中的当前阶段。
Event
  position : Number
[read-only] 获取当前的滚动位置(以像素为单位)。
ScrollEvent
 Inheritedprototype : Object
[static] 对类或函数对象的原型对象的引用。
Object
 Inheritedtarget : Object
[read-only] 事件目标。
Event
 Inheritedtype : String
[read-only] 事件的类型。
Event
公共 方法
 方法定义方
  
ScrollEvent(direction:String, delta:Number, position:Number)
使用指定的参数创建新的 ScrollEvent 对象。
ScrollEvent
  
创建 ScrollEvent 对象的副本,并设置每个参数的值以匹配原始参数值。
ScrollEvent
 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
  
返回一个字符串,其中包含 ScrollEvent 对象的所有属性。
ScrollEvent
 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
 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
  SCROLL : String = "scroll"
[static] 定义 scroll 事件对象的 type 属性值。
ScrollEvent
 InheritedSELECT : String = "select"
[static] 定义 select 事件对象的 type 属性值。
Event
 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
属性详细信息
delta属性
delta:Number  [read-only]

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

获取滚动位置的更改大小(以像素为单位)。正值指示滚动方向为向下或向右。负值指示滚动方向为向上或向左。


实现
    public function get delta():Number
direction属性 
direction:String  [read-only]

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

获取一个常数值,该值指示与事件关联的移动方向。ScrollBarDirection.HORIZONTAL 值指示水平移动;ScrollBarDirection.VERTICAL 值指示垂直移动。


实现
    public function get direction():String

另请参见

position属性 
position:Number  [read-only]

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

获取当前的滚动位置(以像素为单位)。


实现
    public function get position():Number
构造函数详细信息
ScrollEvent()构造函数
public function ScrollEvent(direction:String, delta:Number, position:Number)

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

使用指定的参数创建新的 ScrollEvent 对象。

参数
direction:String — 与事件关联的移动方向。ScrollBarDirection.HORIZONTAL 值指示水平移动;ScrollBarDirection.VERTICAL 值指示垂直移动。
 
delta:Number — 滚动位置的更改(以像素为单位)。正值指示滚动方向为向下或向右。负值指示滚动方向为向上或向左。
 
position:Number — 当前滚动位置。
方法详细信息
clone()方法
public override function clone():Event

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

创建 ScrollEvent 对象的副本,并设置每个参数的值以匹配原始参数值。

返回
Event — 参数值与原始参数值匹配的新 ScrollEvent 对象。
toString()方法 
public override function toString():String

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

返回一个字符串,其中包含 ScrollEvent 对象的所有属性。该字符串具有以下格式:

[ScrollEvent type=value bubbles=value cancelable=value direction=value delta=value position=value]

返回
String — ScrollEvent 对象的字符串表示形式。
常量详细信息
SCROLL常量
public static const SCROLL:String = "scroll"

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

定义 scroll 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理事件对象的对象。
delta1;一个指示完成了多少滚动量的值。
directionvertical;ScrollBar 的方向。
position0;Scrollbar 滑块移动后的位置。
target调度了事件的对象。target 不一定是侦听该事件的对象。使用 currentTarget 属性可以访问侦听该事件的对象。


示例
如何使用示例

下例侦听 scroll 事件,并使用 ScrollEvent 类的 direction 属性来确定内容是水平还是垂直滚动的:

import fl.containers.ScrollPane;
import fl.events.ScrollEvent;
import fl.controls.ScrollBarDirection;

var myScrollPane:ScrollPane = new ScrollPane();
myScrollPane.scrollDrag = true;
myScrollPane.source = "http://www.helpexamples.com/flash/images/image1.jpg";
myScrollPane.addEventListener(ScrollEvent.SCROLL, scrollHandler);
addChild(myScrollPane);

function scrollHandler(event:ScrollEvent):void {
    switch (event.direction) {
        case ScrollBarDirection.HORIZONTAL:
            trace("horizontal scroll", event.position, "of", event.currentTarget.maxHorizontalScrollPosition);
            break;
        case ScrollBarDirection.VERTICAL:
            trace("vertical scroll", event.position, "of", event.currentTarget.maxVerticalScrollPosition);
            break;
    }
}




 

评论添加到页面后给我发送电子邮件 | 评论报告

当前页: http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/fl/events/ScrollEvent.html