8 Replies Latest reply on Nov 14, 2009 4:03 PM by Ned Murphy

    proportionate the image in flash

    Anitha learning flash

      Hello all,

       

      i had a xml wich is dynamically genrate the values, and i use those value to show as a image in flash as2.

      now the values are n numbers, if it is beyound the screen i want to resize the whole image in to best fit on my screen.

       

      I have attached the source file, advance thanks for the help

        • 1. Re: proportionate the image in flash
          Ned Murphy Adobe Community Professional & MVP

          Do you load all of these things into a single movieclip?  If so, then after you have finished loading things, you need to resize the movieclip.

          1 person found this helpful
          • 2. Re: proportionate the image in flash
            Saransoft84

            Hi,

             

            Add the images in scrollpane or add the scroll bar for the images to avoid the unfit

             

            Saransoft

            1 person found this helpful
            • 3. Re: proportionate the image in flash
              Anitha learning flash Level 1

              thanks for your guidance,

               

              please explain me how can we resize the movieclip as best fit in any screen.

              • 4. Re: proportionate the image in flash
                Anitha learning flash Level 1

                the objective is we should not use scroll in this page......

                • 5. Re: proportionate the image in flash
                  Anitha learning flash Level 1

                  Hello all two things i need...

                   

                  one is iam having a xml, with the help of xml values iam doing attachMovie to display movieClip in a screen.

                   

                  1. i need how display the images inside the movieclip

                  2. and how to resize that movieclip to fit on any screen without scroll

                   

                  for to know more about the Objective i have attache the source file 1. fla 2. xml

                  • 6. Re: proportionate the image in flash
                    Ned Murphy Adobe Community Professional & MVP

                    In the code below I show red code which places the pieces inside another movieclip and then resizes it to half its width.  I know you want it to size to fit in the stage, but I don't know to what dimensions, so hopefully you can determine that math for yourself and adjust the width and height accordingly.  It would essentially involve first determining the height/width ratio after the assembly is complete, then changing the width to the desired width, and then using the height/width ratio to set the revised height for the revised width.  And you could keep the holder_mc invisible until all of this is complete if you prefer.

                     

                    unit_mc._visible = false;
                    _root.createEmptyMovieClip("holder_mc", this.getNextHighestDepth()); // create the holding mc
                    ////////////////////////////////////////////////////////
                    //////////////////////loading xml///////////////////////
                    ////////////////////////////////////////////////////////
                    var myXml:XML=new XML();
                    myXml.ignoreWhite = true;
                    myXml.load("sampleInput.XML");
                    myXml.onLoad = function(success)
                    {
                    if (success)
                       {
                    var poc=myXml.firstChild;
                    //trace(poc.attributes.id);
                    var tower=myXml.firstChild.childNodes;
                    //trace(tower.length);
                    var noOfTower=tower.length;
                    for(i=0;i<noOfTower;i++)
                         {
                    var group=myXml.firstChild.firstChild.childNodes;
                    var noOfGroup=group.length;
                    //trace (group);
                    //trace(noOfGroup);
                    //trace(towerId);
                    for(j=0;j<noOfGroup;j++)
                          {
                    var groupId = group[j].attributes.id;        
                    //trace (groupId);   
                    Setting();
                         }
                        

                         }
                       }
                       holder_mc._width = 0.5*holder_mc._width; // resize the holding movieclip
                    };
                    ///////////////////////////////////////////////////////
                    ///////////////////end of loading xml//////////////////
                    ///////////////////////////////////////////////////////
                      Setting=function()
                      {   
                      var curritem1;
                      var depth=i+(j*100);
                      curritem1 = holder_mc.attachMovie("menuitem","_mc",depth); // add the xml pieces
                      curritem1._x=10+(i*160);
                      towerheight=curritem1._height;
                      curritem1._y=560-((j*(towerheight-20)));
                      };

                    • 7. Re: proportionate the image in flash
                      Anitha learning flash Level 1

                      Thank you very much and i will try it for dimensons which i want to be....

                      and again thankyou very much