MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 681

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Description
Event; broadcast to all registered listeners while content is loading. The progress event is not
always broadcast; the
dispatched. This can happen especially if the loaded content is a local file. Your application
triggers the
progress
property.
contentPath
The first usage example uses an
instance. The keyword
component instance. For example, the following code, attached to the ScrollPane component
instance
mySPComponent
on(progress){
trace(this);
}
The second usage example uses a dispatcher/listener event model. A component instance
(
scrollPaneInstance
a function, also called a handler, on a listener object (
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
(
) to the listener object method. Each event object has properties that contain
eventObject
information about the event. You can use these properties to write code that handles the event.
Finally, you call the
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
Example
The following code creates a ScrollPane instance called
object with an event handler for the
about how much content has loaded.
createClassObject(mx.containers.ScrollPane, "scrollPane", 0);
loadListener = new Object();
loadListener.progress = function(eventObj){
// eventObj.target is the component that generated the progress event
// --in this case, scrollPane
trace("logo.swf has loaded " + scrollPane.getBytesLoaded() + " Bytes.");
// track loading progress
}
scrollPane.addEventListener("complete", loadListener);
scrollPane.contentPath = "logo.swf";
event may be broadcast without any
complete
event when the content starts loading by setting the value of the
handler and must be attached directly to a ScrollPane
on()
, used inside an
this
, sends "_level0.mySPComponent" to the Output panel:
) dispatches an event (in this case,
EventDispatcher.addEventListener()
"EventDispatcher class" on page
progress
handler attached to a component, refers to the
on()
progress
listenerObject
method on the component
415.
scrollPane
event that sends a message to the Output panel
events being
progress
) and the event is handled by
) that you create. You
. It then creates a listener
ScrollPane component
681

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

This manual is also suitable for:

Flash mx

Table of Contents