Hi,
I am trying to load a new (empty)movie clip ‘my_mc’ into a child of the main timeline ‘opening_Mc’ position it and then populate it with a series of images using an XML file.
I seem to be having a problem with the creation of a new empty movie clip in ‘opening_Mc’. I am not sure what I am doing wrong. When I tested the core code in a test MC the images loaded perfectly but here I was just creating the new MC in the main timeline.
I am sure it is something to do with the way I am either creating the MC or referencing it. The loop to collect the thumbs seems to work but when the thumbs attempt to load into the new movie clip I get the message “TypeError: Error #1010: A term is undefined and has no properties. at main_working_fla::MainTimeline/thumbLoaded()” for each attempt … as if the new MC ‘my_mc’ is not there.
Here is the code:
function sectionLoad(my_sectionNum:Number, my_x:Number): void{
var my_thumb_x:Number;
var my_thumb_y:Number;
var my_images:XMLList;
var my_section_total:Number;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("section" + my_sectionNum +".xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
}
function processXML (e:Event):void{
var myXML:XML = new XML(e.target.data);
my_images = myXML.image;
my_section_total = my_images.length();
trace(my_images);
createContainer();
callThumbs();
}
function createContainer():void {
var my_mc = new MovieClip();
my_mc.x = my_x;
my_mc.y = 0;
opening_Mc.addChild(my_mc);
}
function callThumbs():void{
for (var i:Number = 0; i < my_section_total; i++){
var thumb_url = my_images*.small_url;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.name = i;
thumb_loader.x = my_images*.xpos;
thumb_loader.y = my_images*.ypos;
}
}
function thumbLoaded(e:Event):void{
var my_thumb:Loader = Loader(e.target.loader);
opening_Mc.my_mc.addChild(my_thumb);
}
Any Ideas? pulling my hair out!
Thx
Andrew