开发者

How do I ignore a Flash component's ADDED_TO_STAGE event during authoring time?

开发者 https://www.devze.com 2022-12-18 20:10 出处:网络
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'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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号