1 Reply Latest reply on Sep 15, 2006 7:27 AM by Newsgroup_User

    Embed images in one MovieClip, use in another?

    Gregory_Berry
      I apologize if you've already read this message. My question isn't only AS, not only Flash, not only Flex. It's in the mysterious area where the three come together. I posted this in the AS discussion, but think it might be better off here.

      Is it possible to embed images (jpgs) in one MovieClip, then load that SWF into another MovieClip and use those images in the loader? We are trying to avoid reloading an image each time we need it, but still load them dynamically. We'd like to do this:

      Container.swf:
      <mx:Application>
      <mx:Script>
      [Embed(source="images/myimage.jpg")]
      public var img: String;
      </mx:Script>
      </mx:Application>

      Then, load that SWF and use its embedded image:

      Loader.swf:
      <mx:Application>
      <mx:Loader id="container" source="Container.swf" />
      <mx:HBox>
      <mx:Image id="the_image" source="container.content.img" />
      </mx:HBox>
      </mx:Application>

      It looks like this should work, and the "resource" string is properly being passed to the_image (something like __Resource.43234564.myimage_jpg) but it cannot actually load; we get a broken image instead.

      I'm guessing I somehow need to register the object library of the Container.swf with my Loader.swf? How?

      Or, is this whole enterprise impossible?

      Thank you!

      Greg


        • 1. Re: Embed images in one MovieClip, use in another?
          Level 7
          In Flash you may use 'export for runtime sharing' future. In Flex there
          must be a way also (look at adobe devnet topics)
          In Flash common problem is you can't control loading progress of this
          add-on. Preload first add-on to one movie without "export for runtime
          sharing" future with loader progress if you need it, then reload common
          movie to 'real' loader - add-on wil be taken from cache


          > I apologize if you've already read this message. My question isn't only AS,
          > not only Flash, not only Flex. It's in the mysterious area where the three
          > come together. I posted this in the AS discussion, but think it might be
          > better off here.
          >
          > Is it possible to embed images (jpgs) in one MovieClip, then load that SWF
          > into another MovieClip and use those images in the loader? We are trying to
          > avoid reloading an image each time we need it, but still load them dynamically.
          > We'd like to do this:
          >
          > Container.swf:
          > <mx:Application>
          > <mx:Script>
          > [Embed(source="images/myimage.jpg")]
          > public var img: String;
          > </mx:Script>
          > </mx:Application>
          >
          > Then, load that SWF and use its embedded image:
          >
          > Loader.swf:
          > <mx:Application>
          > <mx:Loader id="container" source="Container.swf" />
          > <mx:HBox>
          > <mx:Image id="the_image" source="container.content.img" />
          > </mx:HBox>
          > </mx:Application>
          >
          > It looks like this should work, and the "resource" string is properly being
          > passed to the_image (something like __Resource.43234564.myimage_jpg) but it
          > cannot actually load; we get a broken image instead.
          >
          > I'm guessing I somehow need to register the object library of the
          > Container.swf with my Loader.swf? How?
          >
          > Or, is this whole enterprise impossible?
          >
          > Thank you!
          >
          > Greg
          >
          >
          >
          >