620
ActionScript classes
addListener (Stage.addListener method)
public static addListener(listener:
Object
) : Void
Detects when a SWF file is resized (but only if
Stage.scaleMode = "noScale"
). The
addListener()
method doesn't work with the default movie clip scaling setting (
showAll
)
or other scaling settings (
exactFit
and
noBorder
).
To use
addListener()
, you must first create a
listener object
. Stage listener objects receive
notification from
Stage.onResize
.
Availability:
ActionScript 1.0; Flash Lite 2.0
Parameters
listener
:
Object
- An object that listens for a callback notification from the
Stage.onResize
event.
Example
This example creates a new listener object called
stageListener
. It then uses
stageListener
to call
onResize
and define a function that will be called when
onResize
is
triggered. Finally, the code adds the
stageListener
object to the callback list of the Stage
object. Listener objects allow multiple objects to listen for resize notifications.
this.createTextField("stageSize_txt", this.getNextHighestDepth(), 10, 10,
100, 22);
var stageListener:Object = new Object();
stageListener.onResize = function() {
stageSize_txt.text = "w:"+Stage.width+", h:"+Stage.height;
};
Stage.scaleMode = "noScale";
Stage.addListener(stageListener);
See also
onResize (Stage.onResize event listener)
,
removeListener
(Stage.removeListener method)
align (Stage.align property)
public static align :
String
Indicates the current alignment of the SWF file in the player or browser.
Summary of Contents for Flash Lite 2
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...