I want to access the properties of movieclips inside a movieclip.
Below is a code of how the Parent mc is created. It’s looped because it’s gets it data from XML. So there is not one parent movieclip but a number of parent movieclips depending on how many items the XML contains:
function doComplete(e:Event):void {
//create a new variable to store an instance of the XML class. We pass through the data from the XML file.
var xml:XML = new XML(e.target.data);
//we create a new XMLList. This stores the nodes we want to access in the XML file.
var catList:XMLList = xml.item;
//we create another XMLList. This stores the image attribute of the nodes.
//So it will store the location of the image. images/image3.jpg etc.
var images:XMLList = xml.item. @ image;
//we assign a value to the variable created earlier.
//Depending on how many items are in the XML, this number will differ.
//for this example catNum = 3.
catNum = catList.length();
//we start a loop
for (var i:Number = 0; i < catNum; i++) {
//here we create instances of the movieclips in the library and add them to stage.
//create a variable to store the instances of the classes created.
var but:Button = new Button();
if (catList*. @ label != "home") {
//set the x position of the button instances
//the expression adds spacing between the buttons
but.y += ((stage.stageHeight / 2) - (but.height*catNum/2) + (30*i) + (but.height*i) / 2 - 65);
//set the y position of the button instances
but.x=0;
//we tell the instances to go to their second frame and stop.
//This will be their "down" position
but.gotoAndStop(2);
//we give the dynamic text box inside the button some text.
//the text will be the label attribute of each node in the XML.
but.butLabelTxt.text=catList*.@label;
//we assign a name to the button instances.
//names will be but1,but2,but3
but.name="but"+i;
//we add the instances to the stage
addChild(but);
but.buttonMode=true;
//we add the button names to the array created earlier
butClip.push(but.name);
//we add the button names to the array created earlier
butClipMain.push(but.name);
//we add the link values to the array created earlier
linksArray.push(catList*.@link);
//we add an event listener to the button instances.
but.addEventListener(MouseEvent.CLICK, doClick, false, 0, true);
//this prevents the textbox from being mouse enabled
but.mouseChildren=false;
} else {
//set the x position of the button instances
//the expression adds spacing between the buttons
but.height=0;
but.y = 0;
//set the y position of the button instances
but.x=0;
//we tell the instances to go to their second frame and stop.
//This will be their "down" position
but.gotoAndStop(2);
//we give the dynamic text box inside the button some text.
//the text will be the label attribute of each node in the XML.
but.butLabelTxt.text="";
//we assign a name to the button instances.
//names will be but1,but2,but3
but.name="but"+i;
//we add the instances to the stage
addChild(but);
}
//here we create instances of the movieclips in the library and add them to stage.
//create a variable to store the instances of the classes created.
var info:InfoHolder = new InfoHolder();
//set the x position of the infoHolder instances
//the expression adds spacing between the buttons
info.x += (960*i);
//set the y position of the infoHolder instances
info.y=0;
//we give the dynamic text box inside the button some text.
//the text for the headingTxt textbox will be the heading attribute of each node in the XML.
info.moreInfo.headingTxt.text=catList*.@heading;
//the text for the summaryTxt textbox will be the CDATA section of each node in the XML.
info.moreInfo.summaryTxt.text=catList*;
//we assign a name to the infoHolder instances.
//names will be but1,but2,but3
//we add an event listener to the more button inside infoHolder
info.moreInfo.moreBut_mc.addEventListener(MouseEvent.CLICK, doMore, false, 0, true);
//we set buttonMode to true, so that the movieclip will act like a button.
info.moreInfo.moreBut_mc.buttonMode=true;
info.moreInfo.visible=false;
//we add the infoHolder instances as children of the sprite we created earlier.
holderSprite.addChild(info);
//we create a new loader instance
var picLoader:Loader = new Loader();
//we request the images
/*picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
function loaded(event:Event):void {
//we add the images to the clip inside infoHolder
TweenLite.to(info.holderClip_mc, 1, {alpha:1});
}*/
var picURLReq:URLRequest=new URLRequest(images*);
//we load the images
picLoader.load(picURLReq);
info.holderClip_mc.addChild(picLoader);
}
//this sets the first button instance on stage to an "up" position by sending it to its first frame.
MovieClip(getChildByName("but"+0)).gotoAndStop(1);
//we set the newNum variable to one less than the value of the variable catNum
newNum=catNum-1;
}
As you can see there is a movie clip inside the “info” mc called “more info”. Now I want that, with a click of a button, become visible again:
//we create a function called doCLick. It handles the button events.
function doClick(e:MouseEvent):void {
//we create a variable. The value will be the name of the caller.
//if but1 is clicked the value of butString will be but1
var butString:String=String(e.target.name);
info.moreInfo.visible="true";
//we create another variable. The value is the first variable sliced.
//if but1 is clicked the value of slicedString will be 1
var slicedString:String=butString.slice(3);
//we create a new variable and set its value slicedString which has been type cast to a number.
var butNumber:Number=Number(slicedString);
//if a button is clicked send that button to frame 1. its "down" state
e.target.gotoAndStop(1);
//we start another loop
for (var j = 0; j<butClip.length; j++) {
//we loop through the buttons and set them to their "up" state
MovieClip(getChildByName(butClip[j])).gotoAndStop(2);
//we set the button that was clicked to its "down" state
e.target.gotoAndStop(1);
}
//we stop the timer if a button is clicked
timer.stop();
//we call the butTween function and send through a parameter
//if but1 is clicked the parameter will be 1
butTween(butNumber);
}
I get this error:
1120: Access of undefined property info.
So far no solution, can someone help me?