I've built a UIComponent in AS3. When I drag it onto the stage during authoring time, the ADDED_TO_STAGE eve开发者_开发知识库nt fires.
I have an event handler, but it's really only meant to perform actions at runtime, not when I'm dropping the component onto the stage to design the layout. Is there any way to check to see if the component is "running" in a live SWF?
Basically, I don't want the ADDED_TO_STAGE event handler to do anything at design time.
The CS3 components check as follows:
protected function checkLivePreview():Boolean {
if (parent == null) { return false; }
var className:String;
try {
className = getQualifiedClassName(parent);
} catch (e:Error) {}
return (className == "fl.livepreview::LivePreviewParent");
}
Checking this in your ADDED_TO_STAGE
handler should allow you to implement a different behaviour.
精彩评论