UIObject.doLater()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

componentInstance.doLater(target, "function")

Parameters

target A reference to a timeline that contains the specified function.

function A string indicating a function name to be called after a frame within the component movie clip has passed (so the component's properties set in the Property or Component inspector are available).

Returns

Nothing.

Description

Method; calls a user-defined function only after the component has finished setting all of its properties from the Property inspector or Component inspector. All version 2 components that inherit from UIObject have the doLater() method.

Component properties set in the Property inspector or Component inspector may not be immediately available to ActionScript in the timeline. For example, attempting to trace the label property from a CheckBox component using ActionScript on the first frame of your SWF file fails without notification, even though the component appears on the Stage as expected.

Although properties that are set in a class or a frame script are available immediately, most properties assigned in the Property inspector or Component inspector are not set until the next frame within the component itself.

Although any approach that delays access of the property will resolve this problem, the simplest and most direct solution is to use the doLater() method.

Example

The following example shows how the doLater() method is used:

// doLater() is called from the component instance

myCheckBox.doLater(this, "delay");

// The function or method called from doLater().

function delay() {
  trace(myCheckBox.label); // The property can now be traced
  // any additional statements go here
}

Version 8

 

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

Current page: http://livedocs.adobe.com/flash/8/main/00004194.html