4 Replies Latest reply on Aug 3, 2007 3:40 PM by ogden_shooter

    Deeply Confused

    smazr123 Level 1
      I'm a flash developer and have been coding actionscript in flash for a while. I have heard that a lot of people are starting to create flash applications in flex so I thought I would join the crowd. I am very used to setting up my graphical elements in flash and loading the movie clips I need with linkage. My question is, there doesn't seem to be a way to embed graphics and movies in a flex project. Does everything have to be loaded at run-time instead of having it all in a single SWF? Isn't this much less efficient, or not? Also, the documentation mentions that you can load SWFs that are sprites instead of movieClips, how are these sprite SWFs made, is that just a movieclip with only one frame? I feel like I'm missing something obvious... for example, let say I drew a background in flash, and I wanted to use it in my flex application, what would be the best way to do this?
        • 1. Re: Deeply Confused
          smazr123 Level 1
          Reposting. This seems like a really simple question, can noone help me with this?
          • 2. Re: Deeply Confused
            banner_ogdenmd Level 1
            If you are truly looking to Embed a swf or a graphic the easiest way to to use the Ebed... for instance:

            in an mx:Script tag use the embed class then declare a variable imediately after, this will assign the ebedded swf to the mySWF variable.:
            <mx:Script>
            <![CDATA[
            [Embed(source="myswf.swf")]
            public var mySWF:Class
            ]]>
            </mx:Script>

            <!-- Now the output of the swf -->
            <mx:Image id="mySWF_image" source="{mySWF}" />

            You can also include that swf by simply doing the following:
            <mx:Image source="myswf.swf" id="mySWF_image" />

            this is all assuming that your swf is in the same directory as your main mxml file, course you can include directories etc....
            • 3. Re: Deeply Confused
              ntsiii Level 3
              Yes, Embed is a compile time inclusion of the asset.

              The choice between run-time and compile-time asset loading depends on factors like the ultimate size (download footprint) of the app.

              You do get the choice.

              Tracy
              • 4. Re: Deeply Confused
                ogden_shooter Level 1
                I have to say I'm not a big fan of Embed compile time for the exact reason Tracy mentions.... though pulling at run time can create the need to add event listeners in order to make sure your item is loaded before proceeding.

                Mike