4 Replies Latest reply on Sep 21, 2010 5:00 PM by flexy_flex

    Events on a SWC work in Flash but not AIR

    flexy_flex

      I built a SWC (UIMovieClip document) in Flash CS5.

       

      When I use it with Flash (Flash player 10), I can register events directly on all the symbols in the SWC.

      When I use it in AIR (2.0), the only thing I can get events for is the SWC's document member (there are no errors when adding events to other symbols in the SWC, they just never fire).

       

      All the examples I found on the net are using Flash CS3 for display in a web browser.

      Could someone point me to a working solution for incorporating SWC's from Flash CS 5 into AIR 2.0?

        • 1. Re: Events on a SWC work in Flash but not AIR
          blacksyforce Level 1

          Only only the symbols in the SWC that are converted into a SWC Component can be used in Flex.

           

          I don't really understand your problem but if you wawnt to import a symbol made in Flash into Flex do this:

           

          1. Create your symbol

          2. Convert it into a Flex Component (Commands -> Convert symbol to Flex component)

          3. Get the SWC file

          4. Add it into your project (you don't really have to do this but i prefer to)

           

          5. In your Flex project right click it -> Propreties -> Flex Build Path -> Add SWC or Add SWC Folder

          6. Select the file/folder with your SWC

          7. Use the symbols into your project

           

          The symbols will be taken from the library not the stage. Oh ya... one more thing... if you want to use var myVar:MovieClip = ... use UIMovieClip instead.

           

           

          P.S. Sorry if I wrote this 'lil tutorial and that's not what u wore locking for...

          • 2. Re: Events on a SWC work in Flash but not AIR
            flexy_flex Level 1

            Thanks for replying, but I'm not having a general issue getting SWC's to work.  I have a working SWC in Flash (Flex), but when I use the same SWC in an AIR (Flex) application I don't get the same events.

            • 3. Re: Events on a SWC work in Flash but not AIR
              blacksyforce Level 1

              What kind of events do you have ? What kind of listeners ? Who dispatches the events and who has the listeners registered ? Can you post a sample of your code ?

              • 4. Re: Events on a SWC work in Flash but not AIR
                flexy_flex Level 1

                It appears that I needed to instantiate the SWC then instantiate the UIMovieClip member of the SWC from within ActionScript.  Once I did this I was able to register (and receive) events for all members of the UIMovieClip member.