View Full Version : addEventListener properties?
dleeinfo
10-08-2008, 06:24 PM
Hi,
I'm learning from this book Learning Actionscript 3.0, and the writer included some values that states "false, 0, true" without explaining what it is. What is the "false, 0, and true"? Also, I've been trying to find a section on Adobe's website that tells you all the different properties for each class... anyone have the link? Thanks alot
playBtn.addEventListener(MouseEvent.CLICK, onPlayClick, false, 0,
true);
SergeantFlash
10-12-2008, 01:23 AM
If you highlight the 'addEventListener' method and hit F1 on your keyboard, it will bring up the help screen and give you a definition of the method. Here's what I got:
_____
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Parameters
type:String — The type of event.
listener:Function — The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing, as this example shows:
function(evt:Event):void
The function can have any name.
useCapture:Boolean (default = false) — Determines whether the listener works in the capture phase or the target and bubbling phases. If useCapture is set to true, the listener processes the event only during the capture phase and not in the target or bubbling phase. If useCapture is false, the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call addEventListener twice, once with the useCapture set to true, then again with useCapture set to false.
priority:int (default = 0) — The priority level of the event listener. The priority is designated by a signed 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not.
Class-level member functions are not subject to garbage collection, so you can set useWeakReference to true for class-level member functions without subjecting them to garbage collection. If you set useWeakReference to true for a listener that is a nested inner function, the function will be garbge-collected and no longer persistent. If you create references to the inner function (save it in another variable) then it is not garbage-collected and stays persistent.
dleeinfo
10-12-2008, 02:28 AM
thank you. That F1 key is exactly what I was looking for. Appreciate your help!
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.