| 包 | fl.events |
| 类 | public class ScrollEvent |
| 继承 | ScrollEvent Event Object |
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
另请参见
| 属性 | 定义方 | ||
|---|---|---|---|
![]() | bubbles : Boolean
[read-only]
指示事件是否为冒泡事件。
| Event | |
![]() | cancelable : Boolean
[read-only]
指示是否可以阻止与事件相关联的行为。
| Event | |
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。
| Object | |
![]() | currentTarget : Object
[read-only]
当前正在使用某个事件侦听器处理 Event 对象的对象。
| Event | |
| delta : Number
[read-only]
获取滚动位置的更改大小(以像素为单位)。
| ScrollEvent | ||
| direction : String
[read-only]
获取一个常数值,该值指示与事件关联的移动方向。
| ScrollEvent | ||
![]() | eventPhase : uint
[read-only]
事件流中的当前阶段。
| Event | |
| position : Number
[read-only]
获取当前的滚动位置(以像素为单位)。
| ScrollEvent | ||
![]() | prototype : Object
[static]
对类或函数对象的原型对象的引用。
| Object | |
![]() | target : Object
[read-only]
事件目标。
| Event | |
![]() | type : String
[read-only]
事件的类型。
| Event | |
| 方法 | 定义方 | ||
|---|---|---|---|
|
使用指定的参数创建新的 ScrollEvent 对象。
| ScrollEvent | ||
|
创建 ScrollEvent 对象的副本,并设置每个参数的值以匹配原始参数值。
| ScrollEvent | ||
![]() |
在自定义 Event 类中实现 toString() 方法的实用程序函数。
| Event | |
![]() |
指示对象是否已经定义了指定的属性。
| Object | |
![]() |
检查是否已对事件调用 preventDefault()。
| Event | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。
| Object | |
![]() |
如果可以取消事件的默认行为,则取消该行为。
| Event | |
![]() |
指示指定的属性是否存在、是否可枚举。
| Object | |
![]() |
设置循环操作动态属性的可用性。
| Object | |
![]() |
防止对事件流中当前节点中和所有后续节点中的事件侦听器进行处理。
| Event | |
![]() |
防止对事件流中当前节点的后续节点中的所有事件侦听器进行处理。
| Event | |
|
返回一个字符串,其中包含 ScrollEvent 对象的所有属性。
| ScrollEvent | ||
![]() |
返回指定对象的原始值。
| Object | |
| 常量 | 定义方 | ||
|---|---|---|---|
![]() | ACTIVATE : String = "activate" [static]
定义 activate 事件对象的 type 属性值。
| Event | |
![]() | ADDED : String = "added" [static]
定义 added 事件对象的 type 属性值。
| Event | |
![]() | ADDED_TO_STAGE : String = "addedToStage" [static]
定义 addedToStage 事件对象的 type 属性值。
| Event | |
![]() | CANCEL : String = "cancel" [static]
定义 cancel 事件对象的 type 属性值。
| Event | |
![]() | CHANGE : String = "change" [static]
定义 change 事件对象的 type 属性值。
| Event | |
![]() | CLOSE : String = "close" [static]
定义 close 事件对象的 type 属性值。
| Event | |
![]() | COMPLETE : String = "complete" [static]
定义 complete 事件对象的 type 属性值。
| Event | |
![]() | CONNECT : String = "connect" [static]
定义 connect 事件对象的 type 属性值。
| Event | |
![]() | DEACTIVATE : String = "deactivate" [static]
定义 deactivate 事件对象的 type 属性值。
| Event | |
![]() | ENTER_FRAME : String = "enterFrame" [static]
定义 enterFrame 事件对象的 type 属性值。
| Event | |
![]() | FULLSCREEN : String = "fullScreen" [static]
定义 fullScreen 事件对象的 type 属性值。
| Event | |
![]() | ID3 : String = "id3" [static]
定义 id3 事件对象的 type 属性值。
| Event | |
![]() | INIT : String = "init" [static]
定义 init 事件对象的 type 属性值。
| Event | |
![]() | MOUSE_LEAVE : String = "mouseLeave" [static]
定义 mouseLeave 事件对象的 type 属性值。
| Event | |
![]() | OPEN : String = "open" [static]
定义 open 事件对象的 type 属性值。
| Event | |
![]() | REMOVED : String = "removed" [static]
定义 removed 事件对象的 type 属性值。
| Event | |
![]() | REMOVED_FROM_STAGE : String = "removedFromStage" [static]
定义 removedFromStage 事件对象的 type 属性值。
| Event | |
![]() | RENDER : String = "render" [static]
定义 render 事件对象的 type 属性值。
| Event | |
![]() | RESIZE : String = "resize" [static]
定义 resize 事件对象的 type 属性值。
| Event | |
| SCROLL : String = "scroll" [static]
定义 scroll 事件对象的 type 属性值。
| ScrollEvent | ||
![]() | SELECT : String = "select" [static]
定义 select 事件对象的 type 属性值。
| Event | |
![]() | SOUND_COMPLETE : String = "soundComplete" [static]
定义 soundComplete 事件对象的 type 属性值。
| Event | |
![]() | TAB_CHILDREN_CHANGE : String = "tabChildrenChange" [static]
定义 tabChildrenChange 事件对象的 type 属性值。
| Event | |
![]() | TAB_ENABLED_CHANGE : String = "tabEnabledChange" [static]
定义 tabEnabledChange 事件对象的 type 属性值。
| Event | |
![]() | TAB_INDEX_CHANGE : String = "tabIndexChange" [static]
定义 tabIndexChange 事件对象的 type 属性值。
| Event | |
![]() | UNLOAD : 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 属性值。
此事件具有以下属性:
| 属性 | 值 |
|---|---|
bubbles | false |
cancelable | false;没有要取消的默认行为。 |
currentTarget | 当前正在使用某个事件侦听器处理事件对象的对象。 |
delta | 1;一个指示完成了多少滚动量的值。
|
direction | vertical;ScrollBar 的方向。 |
position | 0;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