Mailing List
Home
Forum Home
Flash Pro
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
MenuBar on change cannot be trigerred

MenuBar on change cannot be trigerred

2004-03-13       - By Sajid Saiyed

 Back
Reply:     1     2     3     4     5     6  

Hey Doug, You are great :)

Perfect solution.

thanks
sajid

-- --Original Message-- --
From: Doug Coning [mailto:DougC@(protected)]
Sent: Saturday, March 13, 2004 4:03 AM
To: flashcoders@(protected)
Subject: RE: [Flashcoders] MenuBar on change cannot be trigerred


I too wasn't able to get it to work.  However the following does work
for me, create a new docoument and add the following:

1) Add a menuBar called myMenuBar.

2) Add this script to the main timeline:

SCRIPT:
import mx.controls.Menu;
import mx.controls.MenuBar;
var myMenuBar:MenuBar;
var menuBar_xml:XML = new XML();
menuBar_xml.load("Menu.xml");
menuBar_xml.ignoreWhite = true;
menuBar_xml.onLoad = function(success) {
  if (success) {
    myMenuNodes = menuBar_xml.firstChild;
    numChildren = myMenuNodes.childNodes.length;
    myMenuBar.dataProvider = myMenuNodes;
    for(var i = 0; i<numChildren;i++){
      set("menu_" + i, myMenuBar.getMenuAt(i));
      eval("menu_" + i).addEventListener("change",
fileListener);
      if(i>3000){
        trace("B R E A K : menuBar_xml");
        break;
      }
    }
  } else {
    trace("error in loading menuBar_xml");
  }
};
var fileListener:Object = new Object();
fileListener.change = function(eventObj : Object) : Void {
  trace("Menu item chosen:
"+eventObj.menuItem.attributes.instanceName);
}

3) Create this XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<root>
  <menu label = "File">
      <menuItem label = "New"  instanceName =
"newInstance"/>
      <menuItem label = "Open" instanceName =
"openInstance"/>
      <menuItem label = "Open Recent">
          <openItem label = "CSAUTO"
instanceName = "recent1Instance"/>
          <openItem label = "LOAN"
instanceName = "recent2Instance"/>
          <openItem label = "JOINT"
instanceName = "recent3Instance"/>
          <openItem label = "PERSONAL"
instanceName = "recent4Instance"/>
      </menuItem>
      <menuItem label = "Close" instanceName =
"closeInstance"/>
      <menuItem type = "separator"/>
      <menuItem label = "Save" instanceName =
"saveInstance"/>
      <menuItem label = "SaveAs" instanceName =
"saveAsInstance"/>
      <menuItem type = "separator"/>
      <menuItem label = "Print" instanceName =
"printInstance"/>
      <menuItem type = "separator"/>
      <menuItem label = "Exit" instanceName =
"exitInstance"/>
  </menu>
  <menu label = "Edit">
      <menuItem label = "Undo" enabled = "false"
instanceName = "undoInstance"/>
      <menuItem type = "separator"/>
      <menuItem label = "Preferences" instanceName =
"preferencesInstance"/>
  </menu>
</root>

-- ---- ---- ------

Hope this works for you!

Doug Coning
Software Developer
FORUM Solutions, LLC


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106818
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)

=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106827
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)




Earn $52 per hosting referral at Lunarpages.