在flex中使用Actionscript(MovieClip)类

| 我有一段实现MovieClip的Actionscript代码。我似乎无法使其显示在我的应用程序中。 我尝试过的 1)通过UIObject和Sprite在我的代码中直接使用类。我可以创建UIObject,添加Sprite,然后添加该类的实例。我的应用程序无任何显示。 2)将类作为flex库(swc)放入。编译器不允许我导入它或将其用作显示对象。 3)将类作为flex项目(swf)放入。该文件可以单独运行,但是当我尝试在我的应用程序中使用该文件时,它会显示相同的“损坏”图标。 我在这里缺少一些关键因素。有什么建议吗? 编辑:获得外接程序类以通过库显示。它编译为.SWC文件。不幸的是,它使用全屏作为其“舞台”尺寸。我以前遇到的不可见的问题实际上是(或者我认为)它不在显示窗口的右侧。我在绘图例程中添加了断点,可以看到它正在刷新。所以现在我正试图让它接受一些尺寸。     
已邀请:
        您可以创建UIComponent而不是UIObject,并将动画片段添加到UIComponent。我一直使用UIComponent而不是UIObject,并且我的精灵始终正确显示:) mxml和以下代码:
<mx:UIComponent>
    <mx:Yoursprite></mx:Yoursprite>
</mx:UIComponent>
或用动作脚本编码:
private function createSpriteInFlex():void
{
    var _uiComponent:UIComponent = new UIComponent();
    addElement(_uiComponent);

    var _sprite:YourSprite = new YourSprite();
    _uiComponent.addChild(_sprite);
}
编辑 您可以像这样添加一个mxml行。
<com:myUIComponent width=\"100%\" height=\"100%\"></com:myUIComponent>
因此,myUIComponent实际上是一个您可以自己编写的类。我将在下面演示如何添加精灵或动画片段:
package com.myUIComponent
{
    public class myUIComponent extends UIComponent
    {
        public function myUIComponent()
        {
            super();

            addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);

            //ADD YOUR SPRITE HERE
            var mySprite:YourSprite = new YourSprite();
            addChild(mySprite);
        }
    }
}
    
           1)直接在我的代码中使用类   通过UIObject和Sprite。我可以创造   UIObject,添加Sprite,然后   添加该类的实例。没有   显示在我的应用中。 您提供了移动剪辑和大小吗? (宽度和高度)和位置(x和y)?大小通常更重要,因为x和y通常设置为0、0。
2) Putting the class in as a flex library (swc). The compiler won\'t let me import it or use it as a display object.
您是否已将SWC添加到库路径?您确定您的新影片剪辑包含在SWC中吗?
3) Putting the class in as a flex project (swf). The file runs fine stand alone but gives me the same \"broken\" icon when I try to use it in my app.
听起来您在嵌入路径时遇到了路径问题;但您必须显示代码。     

要回复问题请先登录注册