Hi I’m creating a thumbnails that load in using the loader class. before loading the thumbnail I created containers for them and withing each container there are a couple of display objects one of which is called “_container_mc” which is the nested display object that I need to load the external thumbnails into. In addition to containing a couple of display objects, the container, works as a button. When one container is clicked it is deactivated and all the others are activated. It all works well until I load in the external thumbnails into the nested display object using the Loader Class.
This is the error message that I’m getting:
ReferenceError: Error #1069: Property box_mc not found on flash.display.Loader and there is no default value.
at main_dynamic_fla::MainTimeline/onClick()
Now, the property box_mc is one of the display objects within the container which is no longer found now that I’m using the Loader Class. So just to clarify:
inside the main container I have the following display Object:
buttons (The button being generated through a for loop)
inside buttons I have the following display objects:
container_mc - (this is the display object that the Loader Class is targeting)
box_mc
Here’s the code I’m using:
import gs.*;
var swfLoader:Loader;
var buttons:Button;
var container:Container = new Container();
var buttonsArray:Array = new Array();
var _duration:Number = 0.5;
var currentButton:;
var otherButtons:;
addChild(container);
container.x = 70;
container.y = 130;
for (var i:int = 0; i < 4; i++)
{
buttons = new Button();
container.addChild(buttons);
buttons.name = “button” + i + “_mc”;
buttons.x = (buttons.width + 3) * i;
buttonsArray.push(buttons);
buttons.buttonMode = true;
buttons.percent_txt.mouseEnabled = false;
buttons.container_mc.mouseEnabled = false;
buttons.box_mc.mouseEnabled = false;
swfLoader = new Loader();
swfLoader.load(new URLRequest("swfs/thumb" + i + ".swf"));
buttons.container_mc.addChild(swfLoader);
buttons.addEventListener(MouseEvent.ROLL_OVER, over);
buttons.addEventListener(MouseEvent.ROLL_OUT, out);
//THIS IS WHAT'S CAUSING THE PROBLEM
buttons.addEventListener(MouseEvent.CLICK, onClick);
}
function over(e:MouseEvent):void
{
TweenLite.to(e.target.box_mc, _duration, {alpha:0.5});
}
function out(e:MouseEvent):void
{
TweenLite.to(e.target.box_mc, _duration, {alpha:1});
}
function onClick(e:MouseEvent):void
{
//trace(e.target.name);
TweenLite.to(e.target.box_mc, _duration, {alpha:0.5});
e.target.removeEventListener(MouseEvent.ROLL_OUT, out);
e.target.mouseEnabled = false;
currentButton = e.target;
enableOthers();
}
function enableOthers():void
{
for (var j:int = 0; j < buttonsArray.length; j++)
{
otherButtons = buttonsArray[j];
if (otherButtons != currentButton)
{
otherButtons.mouseEnabled = true;
otherButtons.addEventListener(MouseEvent.ROLL_OUT, out);
TweenLite.to(otherButtons.box_mc, _duration, {alpha:1});
}
}
}
Any help would be greatly appreciated.