Package | fl.livepreview |
Class | public class LivePreviewParent |
Inheritance | LivePreviewParent ![]() |
When a property is set on a component instance or when a component instance is resized on the Stage, Flash makes calls to the methods of this class, which in turn call methods in your component code to set the properties and to resize the component.
In cases where your component must implement a specific action when it is in live preview mode, use the following code to test for live preview mode:
var isLivePreview:Boolean = (parent != null && getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent");
The LivePreviewParent class supports the definition of a setSize()
method that uses width
and height
values to resize
a component. If you do not define a setSize()
method, this object
sets the width
and height
properties individually.
You can also use this class to create a custom live preview SWF file without creating a SWC file; however, it is probably easier to create a component live preview file by:
To create a component live preview file in this way, follow these steps:
In some cases, you may want to have a custom live preview SWF file that is
completely different from your component. See the live preview of the fl.containers.UILoader
component for such an example. This live preview does not use the properties of UILoader,
nor does it implement getter and setter functions for these properties. It does, however,
implement a setSize()
method that uses width
and height
parameters to draw the component at the new size.
Property | Defined by | ||
---|---|---|---|
myInstance : DisplayObject
The component instance.
| LivePreviewParent |
Method | Defined by | ||
---|---|---|---|
Initializes the scale and align modes of the Stage, sets the
myInstance property, resizes myInstance to
the proper size and uses the ExternalInterface class to expose
functions to Flash. | LivePreviewParent | ||
onResize(width:Number, height:Number):void
Resizes the component instance on the Stage to the specified
dimensions, either by calling a user-defined method, or by
separately setting the
width and height
properties. | LivePreviewParent | ||
onUpdate(... updateArray):void
Updates the properties of the component instance.
| LivePreviewParent | ||
propertyInspectorSettingUpdate(updating:Boolean):void
| LivePreviewParent |
myInstance | property |
public var myInstance:DisplayObject
The component instance.
LivePreviewParent | () | constructor |
public function LivePreviewParent()
Initializes the scale and align modes of the Stage, sets the
myInstance
property, resizes myInstance
to
the proper size and uses the ExternalInterface class to expose
functions to Flash.
onResize | () | method |
public function onResize(width:Number, height:Number):void
Resizes the component instance on the Stage to the specified
dimensions, either by calling a user-defined method, or by
separately setting the width
and height
properties.
This method is called by Flash Player.
Parameterswidth:Number — The new width for the myInstance instance.
|
|
height:Number — The new height for the myInstance instance.
|
onUpdate | () | method |
public function onUpdate(... updateArray):void
Updates the properties of the component instance. This method is called by Flash Player when there is a change in the value of a property. This method updates all component properties, whether or not they were changed.
Parameters... updateArray — An array of parameter names and values.
|
propertyInspectorSettingUpdate | () | method |
public function propertyInspectorSettingUpdate(updating:Boolean):void
Parameters
updating:Boolean |