View comments | RSS feed

UIObject.resize

Availability

Flash Player 6 (6.0 79.0).

Edition

Flash MX 2004.

Usage

Usage 1:

on(resize){
   ...
}

Usage 2:

listenerObject = new Object();
listenerObject.resize = function(eventObject){
   ...
}
componentInstance.addEventListener("resize", listenerObject)

Description

Event; notifies listeners that an object has been resized.

The first usage example uses an on() handler and must be attached directly to a component instance.

The second usage example uses a dispatcher/listener event model. A component instance (componentInstance) dispatches an event (in this case, resize) and the event is handled by a function, also called a handler, on a listener object (listenerObject) that you create. You define a method with the same name as the event on the listener object; the method is called when the event is triggered. When the event is triggered, it automatically passes an event object (eventObject) to the listener object method. Each event object has properties that contain information about the event. You can use these properties to write code that handles the event. Finally, you call the EventDispatcher.addEventListener() method on the component instance that broadcasts the event to register the listener with the instance. When the instance dispatches the event, the listener is called.

For more information, see EventDispatcher class.

Example

The following example calls the setSize() method to make sym1 half the width and a fourth of the height when form is moved:

formListener.handleEvent = function(eventObj){
   form.sym1.setSize(sym1.width / 2, sym1.height / 4);
}
form.addEventListener("resize", formListener);

Comments


No screen name said on Aug 26, 2004 at 8:45 PM :
Is the a way to trace out all the properties of an event object? Or is there an event object property that contains resizing information like percentages or pixel values?

Thanks.
MM tech writer said on Aug 27, 2004 at 12:38 PM :
Check out the section about Event Objects in the Handling Component Events chapter:
http://livedocs.macromedia.com/flash/mx2004/main_7_2/00002027.html
jameslyon said on Oct 7, 2005 at 8:33 AM :
[Event("eventName")]

What do these types of lines accomplish? Obviously they aren't necessary for custom classes or they would've been documented

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00002946.html