Hey all,
I have a main timeline with the following code:
import flash.utils.getDefinitionByName;
blackBox.addEventListener(MouseEvent.CLICK, moveTest, false, 0, true);
stop();
var j:Number = 1;
var topNumber:Number = protArray.length;
frontProtMovie.protocolNumber.text = topNumber + " Protocols Found";
var bottomNumber1:Number = 1;
var bottomNumber2:Number = topNumber;
frontProtMovie.sequenceNumber.text = bottomNumber1 + " of " + bottomNumber2;
for (var i:int = 0; i < topNumber; i++) {
var className:String = protArray.pop();
var classRef:Class = getDefinitionByName(className) as Class;
var firstOne:DisplayObject = new classRef();
if(i == 0) {
firstOne.name = “protocol” + i;
trace(firstOne.name);
firstOne.x = 153;
firstOne.y = 30;
firstOne.width = 211;
firstOne.height = 509;
frontProtMovie.addChild(firstOne);
} else {
var spacing:Number = 211 * i;
firstOne.name = “protocol” + i;
trace(firstOne.name);
firstOne.x = 153 + spacing;
firstOne.y = 30;
firstOne.width = 211;
firstOne.height = 509;
frontProtMovie.addChild(firstOne);
}
}
function moveTest(evt:MouseEvent):void {
var wanted:DisplayObject = getChildByName(“protocol0”);
wanted.x -= 50;
}
I keep getting a 1009 error whenever I click the blackBox. Am I not naming the instances of my “firstOne” object correctly? The firstOne object is nested inside the “frontProtMovie” movie clip.
:crying: