| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
|
Hi,
I've got a menu bar with a few drop down sub-menus, which I can target fine. But the mast item on the top level of the menu bar, I want to be "exit", but it will have no sub-menu. How do I go about targetting items on the top level of the menu bar? Thanks, rbb. |
|
|
|
|
|
#2 |
|
Registered User
|
Still learning about this myself.
Here's my best guess. myMenu is the instance name of the Menu Component, (Not the MenuBar which creates the drop down instances) ActionScript Code:
Last edited by CyanBlue; 02-10-2005 at 10:00 PM.. Reason: AS tag is applied |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Sep 2004
Posts: 9
|
Hi!
I have an undocumented solution to how to target the menubar items. Goes like this. ActionScript Code:
If you want to target an onPress on just the menubar item instead of having a dropdown menu on it, you do as this --> The target to "start" is myMenubar.mbItem200 so simply assign ActionScript Code:
![]() ActionScript Code:
So in short the menubar item is named from start to end mbItem200....mbItem20n. Strange that MM dont have this in their docs, go figure. I know my english aint good, sorry for that. Last edited by CyanBlue; 02-10-2005 at 10:01 PM.. Reason: AS tag is applied |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Nov 2002
Posts: 22
|
I'm having trouble with the mbItem200 method you explained. Can you attach a fla example?
thanks. |
|
|
|
|
|
#5 | |
|
Registered User
Join Date: Sep 2004
Posts: 9
|
Quote:
Last edited by Jotun75; 09-15-2004 at 09:45 AM.. |
|
|
|
|
|
|
#6 |
|
Registered User
Join Date: Nov 2002
Posts: 22
|
Thanks! Very interesting. No event listeners needed. Thats why I couldn't get it to work using your method because I was added listeners by mistake. Makes sense now.
I'm curious. How did you find out about this mbItem? Yeah you would think MM would have this in thier docs. |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Sep 2004
Posts: 9
|
I found it out by chance while debugging.
I was curious about the structure and objects created at runtime, so when I did a closer look at the objects on the component in the debugger I discovered the pattern in the reference mbItem200,mbItem201,mbItem202 and so on matched my actual menubar items.Last edited by Jotun75; 09-15-2004 at 01:36 PM.. |
|
|
|
|
|
#8 |
|
Registered User
Join Date: Nov 2002
Posts: 22
|
Nice. That reminds me to use the debugger more often, especially when using these often under-documented components. Thanks again.^^
|
|
|
|
|
|
#9 |
|
Registered User
Join Date: Feb 2005
Posts: 9
|
Thanks for this! You saved me a ton of work. One correction to the syntax of your example:
Code:
myMenubar.mbItem200.onPress(){
//whatever action u want
}
Try to guess what this targets :)
myMenubar.mbItem201.onPress(){
//whatever action u want
}
Code:
myMenubar.mbItem200.onPress = function() {
//whatever action u want
}
Try to guess what this targets :)
myMenubar.mbItem201.onPress() = function() {
//whatever action u want
}
|
|
|
|
|
|
#10 |
|
Registered User
Join Date: Jan 2003
Location: NJ USA
Posts: 14
|
When I attempted this workaround, I got a compiler error if I did not include a level scope when targeting the menubar component.
So... Code:
myMenubar.mbItem201.onPress() = function() { ...
Code:
There is no property with the name 'mbItem201'. but Code:
_level0.myMenubar.mbItem201.onPress() = function() { ...
Thanks for the nod in the right direction! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|