9 Replies Latest reply on Oct 21, 2013 3:48 PM by Ron Colmen

    ignore mc

    Ron Colmen Level 2

      main_mc = sub_mc = 100px X 100px

       

      an OnRelease action is assigned to fit sub_mc inside main_mc (again same theory as the above line).

       

      The user resizes an existing mc inside sub_mc to 200px X 120px

       

      How do I still fit sub_mc inside main_mc, ignoring the resized mc?

        • 1. Re: ignore mc
          Ned Murphy Adobe Community Professional & MVP

          There might be something missing from your explanation/reasoning.  The main_mc's size is defined by whatever is inside it.  Similarly, sub_mc's size is also defined by whatever is inside it.  If you need sub_mc to be 100x100 (so that it makes main_mc 100x100, then you need to make whatever is inside sub_mc 100x100.

           

          Stepping away from that reasoning... regardless of what is is inside main_mc, as long as there is something inside it, then to maintain it at 100x100 you just need to set its _width and _height to 100.  Whatever is inside it will malform to fit those dimensions.

           

          Now what is supposed to be happening when something way inside is 200x120 and it is supposed to be ignored?

          • 2. Re: ignore mc
            Ron Colmen Level 2

            Thanks Ned.

             

            Any resized mc (inside sub_mc) should maintain it's scale while sub_mc fits inside main_mc. Is that possible? (That's the reason for asking a way to ignore any MC over the size of sub_mc)

             

            Simple example

            my_btn.onRelease = function () {

                      sub_mc._width = main_mc._width; //works perfect!

            }

             

            now if a squire is drawn inside sub_mc, and now my_btn is clicked - sub_mc doesn't fit/match main_mc

            • 3. Re: ignore mc
              Ned Murphy Adobe Community Professional & MVP

              I'm probably still missing something, but if you alter sub_mc's size it is also altering main_mc's size.  So if you click that button to assign sub_mc to be as wide as main_mc, it already is... because main_mc became the same size as sub_mc

               

              Maybe what you want to do is...

               

              my_btn.onRelease = function () {

                        main_mc._width = 100;

              }

               

              but that still leaves me wondering why you mention ignoring the contents of sub_mc.... because if you ignore them. they will resize to fir within the size of main_mc... likely distorted.

              • 4. Re: ignore mc
                Ron Colmen Level 2

                Thatnks Ned. May be this would explain better?

                 

                When my_btn is clicked I want sub_mc (blue squire) to be same size as main_mc (grey squire). As you can see new_mc should be ignored to be able to do this.

                 

                img016.jpg

                • 5. Re: ignore mc
                  Ned Murphy Adobe Community Professional & MVP

                  If new_mc is inside sub_mc then it is also part of what defines the size of sub_mc.  If you want that blue area to be what gets sized to match main_mc then you need to isolate that as another mc inside of sub_mc.

                  1 person found this helpful
                  • 6. Re: ignore mc
                    Ron Colmen Level 2

                    You've got it right now but I didn't quite get it this time around? How can new_mc be kept apart from sub_mc while it's inside sub_mc?

                    • 7. Re: ignore mc
                      prodigalmaster Level 2

                      Since sub_mc is NOT just the blue box, then resizing it to the grey box would take into account the red new_mc within sub_mc.

                       

                      The width and height of sub_mc takes into account new_mc, so there is no way of resizing the blue square unless it was a seperate MC.

                       

                      You could go the tricky route and store the width and height of new_mc in a couple of variables, make the new_mc 1x1 (w/h) and set the x, y within the blue box so it does not affect the sub_mc width/height. Then resize sub_mc normally and then use the variables to reset the width/height of the red new_mc within sub_mc.

                       

                      To access new_mc use:

                       

                      sub_mc.new_mc

                      • 8. Re: ignore mc
                        Ned Murphy Adobe Community Professional & MVP

                        new_mc cannot be kept apart from sub_mc unless yopu remove it from it.  If you want that blue area to be treated separately from new_mc then that blue area needs to be an movieclip inside of sub_mc as well.

                        1 person found this helpful
                        • 9. Re: ignore mc
                          Ron Colmen Level 2

                          Thanks Ned.