Hello, I'm just getting to grips with AS3 and have never studied arrays before.
I'm trying to get duplicate movieclips to appear underneath each other every time a button is pressed. The movieclip is called "cartslot". Here's what I have so far:
The first movieclip appears fine, however the second click gives me the error:Code:var checkoutSlotsArray:Array = new Array();
var slot:cartslot = new cartslot();
tShirtBuy.addEventListener(MouseEvent.CLICK, sendShirtToCheckout);
function sendShirtToCheckout (evt:MouseEvent):void {
// If this is the first movieclip being generated
if (checkoutSlotsArray.length == 0) {
// Create a cartslot movieclip as a child
shoppingCart.addChild(slot);
checkoutSlotsArray.push(slot);
// Set the first movieclips position
slot.x = 0;
slot.y = 0;
} else {
// Create another cartslot movieclip as a child
shoppingCart.addChild(slot);
checkoutSlotsArray.push(slot);
// Calculate the bottom of the duplicated clips
var slotPos:Number = ((checkoutSlotsArray.length + 1) * shoppingCart.slot.height);
// Set the duplicate movieclips position
slot.x = 0;
slot.y = slotPos;
}
}
Can anyone give me any pointers? As mentioned, I'm really new to arrays so I'll need very specific instructions if possible. Thanks!Quote:
TypeError: Error #1010: A term is undefined and has no properties.
at indoorshredwebsite_fla::shopmc_17/sendShirtToCheckout()
