3 Replies Latest reply on Jul 1, 2008 8:36 PM by Sherm Stevens

    How to access properties of symbols in loaded SWF?

    Sherm Stevens
      I'm making the migration from Flash to Flex, but I'm running into a dead end on one particular area: accessing and manipulating properties of symbols in a loaded SWF.

      The SWF is actually a simple library of a detailed parts illustration. I would like to load the entire SWF in position, and be able to change the attributes (i.e. colors) of individual symbols (or parts of the illustration). I can load, display and manipulate each symbol separately, but I need the parts to remain in place.

      The original art was created in Illustrator and exported as SWF using the symbols palette.

      I can always go back to Flash, but I'm forcing myself to move forward and do this project in Flex (baptism by fire!!).

      Is there some sort of dot notation to access the symbols from within the SWF, without loading them all separately?

      Let me put this another way: it appears that I can load an SWF and then instantiate each symbol in that SWF, and then load each symbol to the 'stage' (or whatever it's called in Flex) separately.

      I can certainly instantiate each symbol separately, and then align it on stage, but it seems to me to be bass-ackward to do it that way, expecially since I created the original SWF with everything in position.

      Is there no way to access the attributes of the individual symbols within an SWF without separately instantiating them?

      I'm just having trouble getting my head around this. Any help is greatly appreciated.
        • 1. Re: How to access properties of symbols in loaded SWF?
          SujitG Level 2

          Please visit the URLs below for explanation on how to access symbols and do lots more with Flash components in Flex.


          Hope this helps.
          • 2. Re: How to access properties of symbols in loaded SWF?
            Sherm Stevens Level 1

            thanks for the reply. I'll explore the docs you referred me to.

            I didn't ask the question in relation to components. This is simple artwork, but I'm guessing the principals are the same.

            I'll check it out and post my results here.
            • 3. Re: How to access properties of symbols in loaded SWF?
              Sherm Stevens Level 1
              Okay, I took a look at this info and it's what I was already doing.

              Here's a simplified example of what I'm trying to do, using the example in the swf9.pdf file.

              Let's assume I've created a SWF with a "BlueSquare" movieclip (in the symbols panel in Flash, exported for AS). In that clip, there is another symbol called "Star". I import the SWF and BlueSquare symbols in with the following code:
              public var LogoCls:Class;

              [Embed(source=”../assets/circlesquare.swf”, symbol=”BlueSquare”)]
              public var LogoClsBlueSquare:Class;

              If I instantiate the BlueSquare on stage, it includes the Star symbol when previewed, but I can't figure out how to get at the Star symbol to change color. If I apply a color change to the symbol, it changes the entire BlueSquare symbol.

              If I instantiate the Star symbol separately, I can then position it on the stage and make changes, but that requires positioning it with actionscript. I'm trying to not have to position a sub-element of my actual artwork because of it's complexity.

              I'd like to display the main movieclip (or sprite) with the ability to access the attributes of a sub-movieclip or sprite.