8 Replies Latest reply: Oct 15, 2009 5:07 PM by Andrei1 RSS

    Nested DisplayObjects madness !!!

    Ziggizag Community Member

      Ok,

       

      I am "old style" guy who still use Flash authoring environment as I believe working with graphics this way is easier than scripting all the things in document class...

       

      So, I have created in Flash authoring a movieClip with a graphics nested in it. Actually, this graphic is composed of two other nested graphics:

       

      Graphics_A

                      \

                       \

                    Graphics_C

                       /            \

                      /              \

      Graphics_B               \

                                       \

                                   MovieClip_D

       

      Now I suddenly see, that reading MovieClip("MovieClip_D").numChildren returns 2 instead of 1 and actually these children are: Graphics_A and Graphics_B while there is no way to access Graphics_C as this object seems not to exist inside MovieClip_D (at least in scope of ActionScript 3).

       

      This is a madness as Graphics_C is a scaled object and I need to read the value of its scaleX and scaleY !!! The problems is that Graphics_A and Graphics_B scales are 100% and reding these values from MovieClip_D always returns 1.

       

      Any idea what to do with this nasty problem???

       

      Rgs,

      Ziggi

        • 1. Re: Nested DisplayObjects madness !!!
          Andrei1 Community Member

          1. 100% scale in AS3 is 1, 50% - 0.5, 150% - 1.5, etc.

           

          2. Your graph is confusing. What are parent/child relationships between the objects the way you put them on timeline?

          • 2. Re: Nested DisplayObjects madness !!!
            Ziggizag Community Member

            Why is my graph confusing?


            Graphics are actually "Graphic Symbols" (as created in Flash IDE):

             

            So, there are library items:

             

            Graphic symbols "Graphics_A" and "Graphics_B" are nested inside graphic symbol "Graphics_C" while this is nested is inside movie clip "MovieClip_D".

             

            And sure - 100% scale is 1, etc.

            But only "Graphics_C" scale is not 100% but I can't get this value from "MovieClip_D" and this is my problem !!!

            • 3. Re: Nested DisplayObjects madness !!!
              Andrei1 Community Member

              What will happen if you make the graphics MovieClips and link them with class names?

              • 4. Re: Nested DisplayObjects madness !!!
                Ziggizag Community Member

                Sure - if I make them MovieClips then all is working well (even no need to assign a class export, just to give a name), but I try to use Graphic symbols to avoid MovieClip overhead when unnecessary. But that all leads to a simple question:

                 

                What are graphic symbols actually from the AS3 perspective. Seems they are neither "Sprites" nor MovieClips - what they are then???

                 

                Rgs,

                Ziggi

                • 5. Re: Nested DisplayObjects madness !!!
                  Andrei1 Community Member

                  There is no AS representation for graphic symbols. It is sort of legacy thing from the Macromedia/ActionScriptless times when the only way to draw Flash graphics was doing it on timeline. I guess in a couple of generations of Flash graphic symbols will be gone (this is if Flash IDE will exist at all).

                   

                  And there is very little overhead. MovieClip class is almost always imported (always in Flash IDE) and all the movie clip symbols are just instances (duplicates) of MovieClip class that are created at runtime as application unfolds.

                   

                  By the way, you can link them to Sprite if you don't want them to be MovieClips, just write in linkage pannel's base class: flash.display.Sprite

                  • 6. Re: Nested DisplayObjects madness !!!
                    Ziggizag Community Member

                    >> By the way, you can link them to Sprite if you don't want them to be MovieClips,

                    >> just write in linkage pannel's base class: flash.display.Sprite

                     

                    Wow - that's interesting !!!

                     

                    Thank you, Andrei - very helpful!

                     

                    BTW - I do not understand why the hell Adobe does not convert stupid graphic symbols to AS3 Sprites? - That would faciliate the entire issue !!!

                    • 7. Re: Nested DisplayObjects madness !!!
                      Andrei1 Community Member

                      Actually I am not completely correct. If you loop through the children you will see that Flash outputs them as Shapes. Still there is a problem: output is content of the symbol - not symbol itself.

                      • 8. Re: Nested DisplayObjects madness !!!
                        Andrei1 Community Member

                        As I said I suspect this is just a bow to legacy clients/designers. In a way it wouldn't make any difference because, again, one can choose symbol to be movie clip (from Flash IDE perspective - not an instance of MovieClip class) and make it extend Sprite OR ANY OTHER CLASS that extends DisaplyObject. In this case there is no one particular class but zillions of possible classes that people write and link to symbols. Basically, correct thing to do would be to eliminate graphic symbol altogether. But it would freak out a lot of non-programmers.

                         

                        Flash IDE is nearing its end so it make no sense to make drastic changes. In the future, from designers perspective, all these things will be done from Illustrator, Photoshop, etc. Adobe has already developed this framework that allows using other graphics programs and export things into Flash seamlessly.