成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

【easeljs】事件匯總

impig33 / 3148人閱讀

摘要:定義于,表示只有這個(gè)對(duì)象才有這個(gè)事件。加入版本,表示從這個(gè)版本起才加入這個(gè)事件,老版本沒(méi)有這個(gè)事件。這是目前唯一非點(diǎn)擊的鼠標(biāo)輸入事件。這事件在拖拽和類似的需求里很有用。這個(gè)事件一定要啟用。

文章說(shuō)明:為了方便我自己查找easeljs的所有事件,所以我從easeljs的文檔里抄過(guò)來(lái)加上自己的翻譯,會(huì)慢慢補(bǔ)全,漏了的,錯(cuò)了的,評(píng)論一下我會(huì)補(bǔ)上去哦。(不確定翻譯對(duì)不對(duì)的地方我會(huì)留著原文。)

繼承自,表示所有繼承自那個(gè)對(duì)象的對(duì)象都有這個(gè)事件。

定義于,表示只有這個(gè)對(duì)象才有這個(gè)事件。

加入版本,表示從這個(gè)版本起才加入這個(gè)事件,老版本沒(méi)有這個(gè)事件。

“此對(duì)象”表示被添加了這個(gè)事件的對(duì)象

與jquery和js一致,事件的回調(diào)函數(shù)第一個(gè)參數(shù)會(huì)帶上事件對(duì)象,在easeljs文檔event類中可以看到各個(gè)事件屬性的說(shuō)明。

stage的事件全加進(jìn)來(lái)了

easeljs事件默認(rèn)是不支持touch設(shè)備的,需要這樣才可以
var stage = new createjs.Stage("canvasId");
createjs.Touch.enable(stage);
添加事件的方法 on ( type listener [scope] [once=false] [data] [useCapture=false] ) Function

繼承自 EventDispatcher
A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener only run once, associate arbitrary data with the listener, and remove the listener.
This method works by creating an anonymous wrapper function and subscribing it with addEventListener. The wrapper function is returned for use with removeEventListener (or off).
IMPORTANT: To remove a listener added with on, you must pass in the returned wrapper function as the listener, or use remove. Likewise, each time you call on a NEW wrapper function is subscribed, so multiple calls to on with the same params will create multiple listeners.
Example

var listener = myBtn.on("click", handleClick, null, false, {count:3});
function handleClick(evt, data) {
    data.count -= 1;
    console.log(this == myBtn); // true - scope defaults to the dispatcher
    if (data.count == 0) {
        alert("clicked 3 times!");
        myBtn.off("click", listener);
        // alternately: evt.remove();
    }
}

Parameters:

type String
The string type of the event.
listener Function | Object
An object with a handleEvent method, or a function that will be called when the event is dispatched.
[scope] Object optional
The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent).
[once=false] Boolean optional
If true, the listener will remove itself after the first time it is triggered.
[data] optional
Arbitrary data that will be included as the second parameter when the listener is called.
[useCapture=false] Boolean optional
For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
Returns:

Function: Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.

added

繼承自 DisplayObject
當(dāng)此對(duì)象被add到其它容器對(duì)象時(shí)觸發(fā)

click

繼承自 DisplayObject
加入版本 0.6.0
在用戶按下左鍵并在此對(duì)象上松開(kāi)左鍵后觸發(fā)。

dblclick

繼承自 DisplayObject
加入版本 0.6.0
當(dāng)用戶在此對(duì)象上雙擊左鍵后觸發(fā)。

drawend

定義于 stage
加入版本 0.7.0
每次顯示列表被繪制到canvas后并且restore過(guò)canvas context后觸發(fā)。
Dispatched each update immediately after the display list is drawn to the canvas and the canvas context is restored.

drawstart

定義于 stage
加入版本 0.7.0
在清除畫(huà)布和繪制顯示列表之前觸發(fā)??梢栽谡{(diào)用event對(duì)象上使用preventDefault取消這次繪制。
Dispatched each update immediately before the canvas is cleared and the display list is drawn to it. You can call preventDefault on the event object to cancel the draw.

mousedown

繼承自 DisplayObject
加入版本 0.6.0
用戶在此對(duì)象上按下左鍵后觸發(fā)。

mouseenter

定義于 stage
加入版本 0.7.0
當(dāng)鼠標(biāo)指針從canvas區(qū)域外(mouseInBounds == true)移進(jìn)canvas區(qū)域(mouseInBounds == false)后觸發(fā)。這是目前唯一非點(diǎn)擊的鼠標(biāo)輸入事件。

mouseleave

定義于 stage
加入版本 0.7.0
當(dāng)鼠標(biāo)從canvas區(qū)域內(nèi)(mouseInBounds == true)移出(mouseInBounds == false)后觸發(fā)。這是目前唯一非點(diǎn)擊的鼠標(biāo)輸入事件。(我也不知道為何這里的mouseInBounds和上面的相反,看原文吧)

mouseout

繼承自 DisplayObject
加入版本 0.6.0
當(dāng)用戶鼠標(biāo)從該對(duì)象的任意一個(gè)子項(xiàng)離開(kāi)后觸發(fā)。這個(gè)事件一定要啟用enableMouseOver。另請(qǐng)參閱rollout。(寫(xiě)好rollout后如果我還記得這里,會(huì)把這個(gè)鏈接弄好)

mouseover

繼承自 DisplayObject
加入版本 0.6.0
當(dāng)用戶鼠標(biāo)進(jìn)入該對(duì)象的任意一個(gè)子項(xiàng)后觸發(fā)。這個(gè)事件一定要啟用enableMouseOver。另請(qǐng)參閱rollout。(寫(xiě)好rollout后如果我還記得這里,會(huì)把這個(gè)鏈接弄好)

pressmove

繼承自 DisplayObject
加入版本 0.7.0
在此對(duì)象上發(fā)生了mousedown事件后,無(wú)論鼠標(biāo)是否移動(dòng),pressmove事件都會(huì)持續(xù)發(fā)生在此對(duì)象上,直到松開(kāi)鼠標(biāo)按鈕。這事件在拖拽和類似的需求里很有用。
(如果stage上加了這個(gè)事件偵聽(tīng),當(dāng)stage上什么元素都沒(méi)有時(shí),這個(gè)是無(wú)效的,需要用stagemousemove

pressup

繼承自 DisplayObject
加入版本 0.7.0
在此對(duì)象上發(fā)生了mousedown事件后,松開(kāi)鼠標(biāo)會(huì)觸發(fā)。這事件在拖拽和類似的需求里很有用。

removed

繼承自 DisplayObject
當(dāng)此對(duì)象從它的父對(duì)象上移除后會(huì)觸發(fā)。

rollout

繼承自 DisplayObject
加入版本 0.7.0
這個(gè)事件和mouseout很像,但有這些不同:它不冒泡,而且它把該對(duì)象的內(nèi)容認(rèn)為是一個(gè)整體。
例如,myContainer包含著兩個(gè)有重疊部分的子項(xiàng):shapeAshapeB。用戶移動(dòng)他的鼠標(biāo)到shapeA上,然后直接移到shapeB上,然后離開(kāi)他們倆。如果myContainerMouseout:event,會(huì)收到兩個(gè)事件,每個(gè)事件指向一個(gè)子元素:

當(dāng)鼠標(biāo)離開(kāi)shapeA時(shí)target=shapeA

當(dāng)鼠標(biāo)離開(kāi)shapeB時(shí)target=shapeB

然而當(dāng)事件換成rollout,只會(huì)在離開(kāi)myContainer時(shí)才會(huì)觸發(fā)事件(不僅僅是離開(kāi)shapeB),target=myContainer。這個(gè)事件一定要啟用enableMouseOver。
(jquery也有這樣的,但是我忘記jquery中哪個(gè)是只離開(kāi)父對(duì)象才觸發(fā)了。)

rollover

繼承自 DisplayObject
加入版本 0.7.0
這個(gè)事件和mouseover很像,不同之處跟rolloutmouseout的不同之處是一樣的。這個(gè)事件一定要啟用enableMouseOver。

stagemousedown

定義于 stage
加入版本 0.6.0
用戶在canvas上按下左鍵后觸發(fā)。

stagemousemove

定義于 stage
加入版本 0.6.0
當(dāng)用戶在canvas上移動(dòng)鼠標(biāo)時(shí)持續(xù)觸發(fā)。

stagemouseup

定義于 stage
加入版本 0.6.0
當(dāng)用戶在stage的某處按下左鍵,然后在頁(yè)面中能接收事件的任意一處(不同瀏覽器有些不同)松開(kāi)左鍵??梢允褂?b>mouseInBounds檢查鼠標(biāo)是否在stage范圍內(nèi)。

tick

繼承自 DisplayObject: tick:642
加入版本 0.6.0
Dispatched on each display object on a stage whenever the stage updates. This occurs immediately before the rendering (draw) pass. When update is called, first all display objects on the stage dispatch the tick event, then all of the display objects are drawn to stage. Children will have their Tick:event event dispatched in order of their depth prior to the event being dispatched on their parent.
Event Payload:

target Object

The object that dispatched the event.

type String

The event type.

params Array

An array containing any arguments that were passed to the Stage.update() method. For example if you called stage.update("hello"), then the params would be ["hello"].

paused Boolean
指出ticker當(dāng)前是否暫停

delta Number

從上次觸發(fā)事件以來(lái),經(jīng)過(guò)了多少毫秒。

time Number

Ticker實(shí)例化之后經(jīng)過(guò)了多少毫秒

runTime Number

Ticker實(shí)例化之后未被暫停的狀態(tài)下經(jīng)過(guò)了多少毫秒。例如,你可以決定用time-runTime初始化后被暫停的總時(shí)間(The total time in ms that Ticker was not paused since it was initialized. For example, you could determine the amount of time that the Ticker has been paused since initialization with time-runTime.)

tickend

Defined in tickend:294
Available since 0.7.0
Dispatched each update immediately after the tick event is propagated through the display list. Does not fire if tickOnUpdate is false. Precedes the "drawstart" event.

tickstart

Defined in tickstart:287
Available since 0.7.0
Dispatched each update immediately before the tick event is propagated through the display list. You can call preventDefault on the event object to cancel propagating the tick event.

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/78593.html

相關(guān)文章

  • easeljs】矢量形狀 Shape類

    摘要:類介紹繼承自一個(gè)形狀允許你在顯示列表中顯示矢量圖。它包含一個(gè)帶有所有繪制矢量圖形的方法的圖形實(shí)例。實(shí)例可以在多個(gè)實(shí)例之間共享,以做到一樣的矢量圖形在畫(huà)布上有多個(gè)不同位置和不同變形的復(fù)制。 類介紹 繼承自 DisplayObject 一個(gè)Shape(形狀)允許你在顯示列表中顯示矢量圖。它包含一個(gè)帶有所有繪制矢量圖形的方法的Graphics(圖形)實(shí)例。Graphics實(shí)例可以在多個(gè)Sha...

    mengbo 評(píng)論0 收藏0
  • Vue項(xiàng)目引入CreateJS的方法(親測(cè))

    摘要:前言介紹是基于開(kāi)發(fā)的一套模塊化的庫(kù)和工具。包含類工具庫(kù)提供了一套完整的,層次化的顯示列表的互動(dòng)方式來(lái)更簡(jiǎn)單的處理畫(huà)布。方法一安裝注意這里下載的版本不是官網(wǎng)最新版本。 1 前 言 1.1 CreateJS介紹 showImg(https://segmentfault.com/img/remote/1460000019340654); CreateJS是基于HTML5開(kāi)發(fā)的一套模塊化的庫(kù)和...

    golden_hamster 評(píng)論0 收藏0
  • CreateJS入門(mén) -- 注釋詳細(xì)到爆炸(My Style)

    摘要:以后所有的文章都會(huì)第一時(shí)間更新到這里,然后同步到其他平臺(tái)。獲取畫(huà)布的寬和高,后面計(jì)算使用定義靜態(tài)資源人物動(dòng)作雪碧圖天空地面遠(yuǎn)山近山創(chuàng)建資源加載隊(duì)列用還是用標(biāo)簽來(lái)加載如果是的時(shí)候,就用標(biāo)簽來(lái)加載,如果不能用標(biāo)簽的話,就用來(lái)加載。 寫(xiě)在前面 首先,還是謝謝大家的支持,謝謝!記得在之前的文章中我說(shuō)過(guò)自己算是一個(gè)半文藝程序員,也一直想著寫(xiě)一寫(xiě)技術(shù)性和其他偏文學(xué)性的文章。雖然自己的底子沒(méi)有多么優(yōu)...

    Render 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<