actionscript-3 - 无法让 Flash 组件 (SWC) 在实时预览中访问库

标签 actionscript-3 flash actionscript components

我正在构建一组 Flash 组件,能够用库中的另一个组件替换组件的外观。

目前,我可以在运行应用程序后访问库,但不能在实时预览期间访问,我想知道组件是否可以在实时预览模式(您可以拖动的模式)下运行时访问库舞台周围的组件并在“组件参数”窗口中更改其属性)

Here is a simplified code that just looks to see if there is a symbol of the name specified and than instantiates it and adds it as a child.

package 
{
    import fl.core.UIComponent;
    import flash.display.MovieClip;
    import flash.system.ApplicationDomain;

    /**
     * ...
     * @author Roy Lazarovich
     */
    public class CompTest extends UIComponent 
    {
        private var customfile  :String;

        public function CompTest()
        {

        }

        override protected function configUI():void
        {

        }

        override protected function draw():void
        {
            super.draw();
        }

        private function setCustomFile():void
        {
            if (ApplicationDomain.currentDomain.hasDefinition(customfile))
            {
                var c:Class = Class(ApplicationDomain.currentDomain.getDefinition(customfile));
                var mc:MovieClip = new c();
                addChild(mc);
            }
        }

        [Inspectable(name = "_Custom File", defaultValue = "")]
        public function set _customfile(value:String):void
        {
            customfile = value;
            setCustomFile();

            drawNow();
        }

    }

}

谢谢!

最佳答案

我不完全确定您已经尝试过什么来解决这种情况。但希望这可能会有所帮助。

右键单击库中的 MovieClip,选择 Linkage 并为其指定一个类名,即。我的东西。

在您的代码中,

newMyThing = new MyThing();
this.addChild(newMyThing);
trace("tada!");

希望对您有所帮助或让您更接近解决方案。

关于actionscript-3 - 无法让 Flash 组件 (SWC) 在实时预览中访问库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11327561/

相关文章:

java - 在 Google Chrome 中选择文件夹而不是文件

apache-flex - 更改 Flex 中多个对象的属性

flash - 数组的奇怪行为

actionscript-3 - 如何取消 Halo/Spark TextInput 和 TextArea 组件中的编辑

xml - 用于 AS3/Flex/Adobe AIR 应用程序的流解析器 (JSON/XML)

centos - Flash Player & Xvfb : Application crashed with an unhandled SIGSEGV

flash - gotoAndPlay/gotoAndStop 不适用于数字帧标签

actionscript-3 - Starling - 将 SWF 图像(矢量)加载到图像中

actionscript-3 - 在 Flash 网站上添加元数据

python - RTMP:使用 Python 检查流是否在线