如何在Flash中创建Flex Display组件?

发布于 2024-08-20 07:57:44 字数 635 浏览 10 评论 0原文

我使用 Flash 制作皮肤,将其导入并应用于 Flex 组件。

但是如何在 Flash 中创建具有属性和方法的组件。并使其能够添加到 Flex 应用程序中的 displayList 中?

我安装了 Flash 的 Flex 组件套件。在 Flash 中创建了我的组件(它扩展了 MovieClip)。执行Command->Convert to flex Component,执行File->Published,这给了我一个.swc,将.sec 文件放入我的Flex 项目中。现在,当我创建一个新变量时,“FlashFlexComponentTest”类会在新类提示框中弹出,因此 Flex 可以看到它。但后来我收到错误:

类型未找到或不是 编译时常量:FlashFlexComponentTest

我觉得我一定错过了一个步骤?

谢谢!

更新

我通过项目构建路径添加了 .swc ->添加SWC。 我不再有编译时错误,但出现运行时错误:

类型强制失败:无法将 FlashFlexClassTest@9089129 转换为 mx.core.IUIComponent

I have used Flash to make skins, which I import and apply to Flex components.

But how can I create a component in Flash, with properties and methods. And make it able to be added to the displayList in a Flex app?

I installed the Flex component kit for flash. Created my component in flash (it extends MovieClip). Did Command->Convert to flex Component, did File->Published, which gave me a .swc, dropped the .sec file into my Flex project. Now when I create a new var the class "FlashFlexComponentTest" pops up in the new class hint box, so flex sees it. But afterwards I get the error:

Type was not found or was not a
compile-time constant: FlashFlexComponentTest

I feel like I must be missing a step?

Thanks!

UPDATE

I added the .swc via project build path -> add SWC.
I no longer have a compile-time error but I am getting a runtime error:

Type Coercion failed: cannot convert FlashFlexClassTest@9089129 to mx.core.IUIComponent

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

音栖息无 2024-08-27 07:57:44

所有 Flex 组件的基类 UIComponent 允许您添加未实现 IUIComponent 接口的 Sprite。

一个例子:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="init();">

  <mx:Script>
    <![CDATA[

        private function init():void 
        {
            var component:FlashFlexClassTest = new FlashFlexClassTest();
            container.addChild(component);
        }

     ]]>
  </mx:Script>
  <mx:UIComponent id="container" width="100%" height="100%"/>
</mx:Application>

The base class for all flex components, UIComponent, allows you to add Sprites that don't implement the IUIComponent interface.

An example :

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="init();">

  <mx:Script>
    <![CDATA[

        private function init():void 
        {
            var component:FlashFlexClassTest = new FlashFlexClassTest();
            container.addChild(component);
        }

     ]]>
  </mx:Script>
  <mx:UIComponent id="container" width="100%" height="100%"/>
</mx:Application>
半窗疏影 2024-08-27 07:57:44

Linda.com 上有一个关于这方面的很好的视频教程,作者是 David Something。大约一年前,我做了很多这样的事情,这是我找到的最好的资源。并没有涵盖绝对所有可能的角度,但很好地涵盖了您需要了解的内容。

我猜您只是缺少一些小的链接细节。如果是这样的话,本教程应该会让您明白。对我来说,每月订阅 20 美元还是值得的。

抱歉,这是我能做的最好的事情...自去年以来就没有在 Flash 中构建 Flex 组件。

There's a good video tutorial on this at Linda.com by David something. I did a lot of this a year or so ago, and that was the best resource I found. Doesn't cover absolutely every possible angle, but does a great job of covering what you need to know.

I'm guessing there's just some small linkage detail that you're missing. The tutorial should get you straight, if that's the case. It was worth the $20, or whatever, for a monthly subscription for me.

Sorry, that's the best I can do... haven't built Flex components in Flash since last year.

自找没趣 2024-08-27 07:57:44

基本上有几个步骤需要做:

  1. 打开Flash,
  2. 拖动您需要的组件,
  3. 在“库”>中右键单击它;导出到 SWC 将此
  4. SWC 放入您的 Flash Builder libs 文件夹中

有 Jesse Warden 的解释 http://jessewarden.com/2011/06/integrating-flash-components-with-flex-revisited.html

干杯!

basically there are step what need to do:

  1. open Flash
  2. drag a component you need to stage
  3. right click on it in Library > Export to SWC
  4. put this SWC in your Flash Builder libs folder

There is explanation by Jesse Warden http://jessewarden.com/2011/06/integrating-flash-components-with-flex-revisited.html

Cheers!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文