10 Replies Latest reply on Jan 21, 2010 12:57 AM by tommy0xAA

    MovieClip inside FlashBuilder


      I hope someone can help me.

      This is my question.

      I have a fla file and inside it, on the stage a moviclip (ret_mc).

      How can i get the ret_mc properties from flash builder actionscript file?


      Thank you


        • 1. Re: MovieClip inside FlashBuilder
          injpix Level 3

          Create a Document Class for your FLA file.  And then declare your MovieClip instance(s) that are on stage in it.  A minimal example can be the following:




            class MySWF extends MovieClip


             //this movieclip is on MySWF.fla's stage.

             private var ret_mc:MovieClip;

             public function MySWF()







          If MySWF is outside of your FlashBuilder workspace you can add it to the Flex project by doing the following:


          -right-click on your Flex project in the Package Explorer and navigate to: Properties > Flex Build Path > Source path.  Click on 'Add Folder...'  Then naviage to where MySWF.fla and MySWF.as resides.


          By doing this, FlashBuilder can introspect (for debugging and building) MySWF.as file.  And having said that, it NEEDS to have rect_mc declared.


          I am not sure if this answers your question.  You can declare ret_mc's child movieclips by declaring them by using the dot operator:


          stroke_mc = ret_mc.stroke_mc;


          Does that help?  Also it isnt necessary for this example to declare stroke_mc.  Since ret_mc is a MovieClip, and MovieClip is a dynamic class, you can get away without declaring it.

          • 2. Re: MovieClip inside FlashBuilder
            markuspedro Level 1


            thank you for your replay.

            This is what i finding for, but it seems not working.

            I have a fla inside flash builder project.

            On its stage there is a moviclip (rect_mc).

            But when i try to get rect_mc istance from document class inside flash builder i received this message ("rect_mc is null") :-(


            Any help?

            • 3. Re: MovieClip inside FlashBuilder
              injpix Level 3

              When a SWF is loaded you should be able to access it's movieclip(s) on stage.  I am using SWFLoader to load a SWF and have a breakpoint before it is attached to the display list.  When FlashBuilder's debugger has stopped at this point, a movieclip is loaded and available (so its not null).


              If you are trying to access this movieclip via a Flex object instance, you need to wait until the SWF is added to the display list.  Perhaps you are trying to access this movieclip too early.


              Let us know where you are at.

              • 4. Re: MovieClip inside FlashBuilder

                If I simply create a new FLEX project and add the FLA path to Sources, the constructor for my DocumentClass never hits.  I just see it call the constructor for the Flex class (the <fx:Decalarations> block.


                How do I tell the flex application that the main entry point is now in the FLA's DocumentClass?  Isn't the "Actionscript Project" intended for this purpose?  The project with that is it doesn't seem to load any external SWF files unless theh have an SWC export.  Flex seems to load fla files.  Is there a document somewhere that explains the behavior of the compiler for FLA/SWF/SWC/FLEX/AS Project?


                The option to "Set As Default Application" is grayed out for .AS files, .SWF, .SWC and .FLA in a Flex project.

                • 5. Re: MovieClip inside FlashBuilder
                  Jason San Jose Adobe Employee

                  The Flex compiler does not compile FLA files. There are various ways that you can structure your project and edit the ActionScript associated with your FLA file. You can also or publish SWCs and/or SWFs from Flash Professional for use in a Flash Builder project.


                  If you want to compile and run FLA files, you should be using Flash Professional.


                  Adobe announced integration features between FB and Flash Pro at MAX 2009. I think you'll find this presentation interesting http://tv.adobe.com/watch/max-2009-design/coding-with-flash-professional-and-builder.


                  Here are a few more links you may want to read:


                  Working with Flash and Flex

                  http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSFD77A256-0DE1-46c7-86FB-CC4A8AE2EAA6.h tml


                  How to use fla files in Flex Builder 3



                  Jason San Jose

                  Quality Engineer, Flash Builder

                  1 person found this helpful
                  • 6. Re: MovieClip inside FlashBuilder
                    markuspedro Level 1

                    Thank you for the answer... ;-)

                    • 7. Re: MovieClip inside FlashBuilder
                      tommy0xAA Level 1

                      Thanks Jason, I watched the video on Flash Professional + FB and it certainly looks like a real solution to this workflow, and eagerly awaiting the CS5 beta.


                      In the mean time, what's the best  solution with CS4 + FB?  I posted more details on a similar problem here:  http://forums.adobe.com/thread/559469


                      In the last link you sent, the author says he he doesn't use a document class at all, instead, he imports the SWF.  I'm not sure if he's generating a SWC or not and it's not clear how he defines his entry point and references stage instances.  Especially in the case of multiple SWF/SWC files being imported, you'd have several stages and no clear way to differentiate them.

                      • 8. Re: MovieClip inside FlashBuilder
                        Jason San Jose Adobe Employee

                        I follow up on the other thread.


                        Jason San Jose

                        Quality Engineer, Flash Builder

                        • 9. Re: MovieClip inside FlashBuilder
                          markuspedro Level 1

                          So, if you want to use a document class inside flash builder it's possible retrive mc on fla stage.

                          The compiler however return a "compile error" but the instance run.

                          • 10. Re: MovieClip inside FlashBuilder
                            tommy0xAA Level 1

                            Using a DocumentClass isn't really needed with FLEX since the "Set As Default Application" replaces behavior.  And if you reference external SWC's, the DocumentClass and all stage info is actually ignored/discarded, flex just pulls in exported symbols (stage symbols are thrown away too I believe). The one time when the documentclass is still used is if you LoadContext(some_swf) from flex.  This will cause the constructor of the documentclass to be called when the swf finishes loading.  It also appends the whole stage to the application stage as a child.


                            I've been doing a lot of "reverse engineering" by building small sample projects tonight so my head is full of FLEX<->CS4 noise!  A whitepaper from adobe on this would be very nice.