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);
}
}
You can’t have two functions of the same name in the same place in ActionScript. You’ll have to rename your copy(ies) to something else.
Yea, I’m just confused on which parts of the functions I need to change the name on?
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.buttonMode=true; OrderPrepOnlineMenuInstance.OrderPrepOnlineClose.addEventListener(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:InventoryGridsOnlineDescBox = new InventoryGridsOnlineDescBox();
var InventoryGridsOnlineDescBoxInstanceOnStage:Boolean=false;
OrderPrepOnlineMenuInstance.loadInvGrids.addEventListener(MouseEvent.CLICK, loadInventoryGridsOnlineDescBox);
InventoryGridsOnlineDescBoxInstance.InventoryGridClose.buttonMode=true; InventoryGridsOnlineDescBoxInstance.InventoryGridClose.addEventListener(MouseEvent.CLICK, removeInventoryGridsOnlineDescBox);
function loadInventoryGridsOnlineDescBox(e:MouseEvent):void {
addChild(OrderPrepOnlineMenuInstance);
InventoryGridsOnlineDescBoxInstance.x = 465;
InventoryGridsOnlineDescBoxInstance.y = 230;
InventoryGridsOnlineDescBoxInstanceOnStage=true;
}
function removeInventoryGridsOnlineDescBox(e:MouseEvent):void {
if (InventoryGridsOnlineDescBoxInstanceOnStage) {
removeChild(InventoryGridsOnlineDescBoxInstance);
InventoryGridsOnlineDescBoxInstanceOnStage=false;
}
}