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
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.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)));
};