-
Adding/Removing movieclips that are nested
So I'm trying to figure out how to create popup boxes within popup boxes. I have the first popup box figured out and I tried to just copy the code for the first box and just change the buttons and AS for the second one but I just get an error that says "duplicate function definition" for the loadMC part.
Here's an example of what I'm trying to do and my AS code:
// -- ONLINE WORKFLOW --
//Order Prep Main
var OrderPrepOnlineMenuInstance:OrderPrepOnlineMenu = new OrderPrepOnlineMenu();
var mcOnStage:Boolean=false;
loadOrderPrepOnlineBtn.addEventListener(MouseEvent .CLICK, loadMC);
OrderPrepOnlineMenuInstance.OrderPrepOnlineClose.b uttonMode=true; OrderPrepOnlineMenuInstance.OrderPrepOnlineClose.a ddEventListener(MouseEvent.CLICK, removeMC);
function loadMC(e:MouseEvent):void {
addChild(OrderPrepOnlineMenuInstance);
OrderPrepOnlineMenuInstance.x = 465;
OrderPrepOnlineMenuInstance.y = 230;
mcOnStage=true;
}
function removeMC(e:MouseEvent):void {
if (mcOnStage ) {
removeChild(OrderPrepOnlineMenuInstance);
mcOnStage=false;
}
}
//Order Prep - Inventory Grids
var InventoryGridsOnlineDescBoxInstance:InventoryGrids OnlineDescBox = new InventoryGridsOnlineDescBox();
loadIventoryGridsOnlineBtn.addEventListener(MouseE vent.CLICK, loadMC);
InventoryGridsOnlineDescBoxInstance.InventoryGrids Close.buttonMode=true; InventoryGridsOnlineDescBox.InventoryGridsClose.ad dEventListener(MouseEvent.CLICK, removeMC);
function loadMC(e:MouseEvent):void {
addChild(InventoryGridsOnlineDescBoxInstance);
InventoryGridsOnlineDescBoxInstance.x = 465;
InventoryGridsOnlineDescBoxInstance.y = 230;
}
function removeInventoryGridsMC(e:MouseEvent):void {
if (mcOnStage ) {
removeChild(InventoryGridsOnlineDescBoxInstance);
}
}
-
So I'm no longer getting any error messages but I can't get the second popup box to load?
Here's my code now:
// -- ONLINE WORKFLOW --
//Order Prep Main
var OrderPrepOnlineMenuInstance:OrderPrepOnlineMenu = new OrderPrepOnlineMenu();
var mcOnStage:Boolean=false;
loadOrderPrepOnlineBtn.addEventListener(MouseEvent .CLICK, loadOrderPrepOnlineMenu);
OrderPrepOnlineMenuInstance.OrderPrepOnlineClose.b uttonMode=true; OrderPrepOnlineMenuInstance.OrderPrepOnlineClose.a ddEventListener(MouseEvent.CLICK, removeOrderPrepOnlineMenu);
function loadOrderPrepOnlineMenu(e:MouseEvent):void {
addChild(OrderPrepOnlineMenuInstance);
OrderPrepOnlineMenuInstance.x = 465;
OrderPrepOnlineMenuInstance.y = 230;
mcOnStage=true;
}
function removeOrderPrepOnlineMenu(e:MouseEvent):void {
if (mcOnStage) {
removeChild(OrderPrepOnlineMenuInstance);
mcOnStage=false;
}
}
//Order Prep - Inventory Grids
var InventoryGridsOnlineDescBoxInstance:InventoryGrids OnlineDescBox = new InventoryGridsOnlineDescBox();
var InventoryGridsOnlineDescBoxInstanceOnStage:Boolean =false;
OrderPrepOnlineMenuInstance.loadInvGrids.addEventL istener(MouseEvent.CLICK, loadInventoryGridsOnlineDescBox);
InventoryGridsOnlineDescBoxInstance.InventoryGridC lose.buttonMode=true; InventoryGridsOnlineDescBoxInstance.InventoryGridC lose.addEventListener(MouseEvent.CLICK, removeInventoryGridsOnlineDescBox);
function loadInventoryGridsOnlineDescBox(e:MouseEvent):void {
addChild(OrderPrepOnlineMenuInstance);
InventoryGridsOnlineDescBoxInstance.x = 465;
InventoryGridsOnlineDescBoxInstance.y = 230;
InventoryGridsOnlineDescBoxInstanceOnStage=true;
}
function removeInventoryGridsOnlineDescBox(e:MouseEvent):vo id {
if (InventoryGridsOnlineDescBoxInstanceOnStage) {
removeChild(InventoryGridsOnlineDescBoxInstance);
InventoryGridsOnlineDescBoxInstanceOnStage=false;
}
}
-
.
Hi,
Try attaching your *.fla so we don't have to try and recreate your file and library items, although I understand the code, the long Names give me a headache
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|