Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-03-2009, 10:18 AM   #1
dreamdelerium
Registered User
 
Join Date: Apr 2009
Posts: 4
Default [AS2] menu bar-add item problem

hi everyone. im new to the forum, and flash/actionscript 2, so let me know if im doing something wrong. anyway heres my question. im creating a card game. i have a seperate timeline for the menu bar. ive placed this code on the first cell of the timeline:
ActionScript Code:
import mx.controls.Menu; import mx.controls.MenuBar; var my_mb:MenuBar; var my_menu:Menu = my_mb.addMenu("File"); my_menu.addMenuItem({label:"New Game", instanceName:"newInstance"}); my_menu.addMenuItem({label:"Reset Cards", instanceName:"openInstance"}); my_menu.addMenuItem({label:"Close", instanceName:"closeInstance"}); my_menu.addMenuItem({label:"Deal New Row", instanceName:"newRow"}); //Create listener object. var mbListener:Object = new Object(); mbListener.change = function(evt_obj:Object) {  var menuItem_obj:Object = evt_obj.menuItem;  switch (menuItem_obj.attributes.instanceName) {  case "newInstance":   _root.gotoAndStop(10);   break;  case "openInstance":   ResetCards();   break;  case "closeInstance":   break;  case "newRow":  dealNewRow();   break;  } }; my_menu.addEventListener("change", mbListener);

the problem i get is that when the user selects "new game" it should restart the game. when it does this the toolbar is not reset. instead a new menu item is added (without removing the old one. so evertime the user hits new game, a new "file" menu is added). how do i make sure there is only 1 "File" menu?
dreamdelerium is offline   Reply With Quote
Old 04-03-2009, 02:39 PM   #2
nageekdoog
Registered User
 
Join Date: Feb 2005
Location: Illinois
Posts: 31
Default

what's in your resetCards() function. Could it be in there?

You could try making a default case in your switch. It could be botching something up somehow maybe...?

I think without more code it'll be hard to figure that one.
nageekdoog is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with a menu rebell1607 ActionScript 2.0 1 06-25-2008 04:05 PM
Problem with creating drop down menu! aronfre Simple Stuff (Newbies) 4 05-07-2008 05:47 PM
Problem With Flash Menu! I cant organize my pages! jpf566 ActionScript 2.0 0 03-05-2008 12:39 PM
Drop down menu bobbyopulent ActionScript 2.0 1 08-31-2006 10:01 PM
how to make a swf file without the menu bar arun67 ActionScript 1.0 (and below) 5 09-13-2001 02:27 AM


All times are GMT. The time now is 04:36 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.