开发者

How to create a Flex Display component in Flash?

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 "FlashFlexCompo开发者_开发知识库nentTest" 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


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>


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.


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!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜