I waited patiently for beta 3 and tried again, but the problem
persists. Now the only methods that are executed are setSelected and
isEnabled. Any clues??
Thank you,
N51
--- In flexcoders@yahoogroups.com, "Matt Chotin" <[EMAIL PROTECTED]> wrote:
>
> At first glance I don't see anything wrong. Wait a few more days
for B3 where I believe we've fixed a lot of menu problems.
>
> Matt
>
> -----Original Message-----
> From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of n51red
> Sent: Thursday, May 04, 2006 5:59 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Implementing IMenuDataDescriber (Flex 2.0
beta)
>
> Hello,
>
> I'm new to flex but haev an object orientated background.
>
> I'm trying to populate a MenuBar with data from a data structure
I've
> implemented.
> This data structure revolves round a class I've called Category
that
> contains an ArrayCollection of child Categories. I've been
attmpting
> to bind the root category to the dataProvider of the MenuBar, while
> providing an implementation of IMenuDataDescriber to provide access
> to my Category class. As the online documentation on the
> IMenuDataDescriber interface is currently incomplete I've done a
> certain amount of guess work on what the functions are supposed to
do.
>
> When I run this the label for the root Category is displayed
> correctly but when I click on it, no menu appears, although the
label
> becomes highlighted to indicate it is selected.
>
> I placed breakpoints in each of the functions in my
> IMenuDataDescriber implementation to see what was happening, and
the
> only function that is ever executed is isEnabled
(node:Object):Boolean.
>
> Any help with this would be greatly appreciated. Here's the code
for
> my IMenuDataDescriber implementation and the Category class it is
> relavent to:
>
> package components {
> import mx.controls.menuClasses.IMenuDataDescriptor;
> import mx.collections.*;
> import model.*;
> import events.*;
>
> public class CategoryMenuDataDescriptor implements
> IMenuDataDescriptor
> {
> public function isSelected(node:Object):Boolean
> {
> return node==ModelLocator.getInstance
> ().selectedCategory;
> }
>
> public function CategoryMenuDataDescriptor() {
> }
>
> public function setEnabled(node:Object,
> value:Boolean):void {
> }
>
> public function isBranch(node:Object,
> model:Object=null):Boolean
> {
> return !(node is Category);
> }
>
> public function getData(node:Object,
> model:Object=null):Object {
> return node as Category;
> }
>
> public function getGroupName(node:Object):String {
> return (node as Category).label;
> }
>
> public function getChildren(node:Object,
> model:Object=null):ICollectionView {
> return (node as Category).getChildren();
> }
>
> public function getType(node:Object):String {
> return null;
> }
>
> public function setSelected(node:Object,
> value:Boolean):void {
> }
>
> public function isEnabled(node:Object):Boolean {
> return true;
> }
> }
> }
>
> package model {
> import mx.collections.ArrayCollection;
>
> [Bindable]
> public class Category {
> private var name:String;
> private var childCategories:ArrayCollection;
>
> public function get label():String{ return name; }
>
> public function Category(n:String)
> {
> name=n;
> childCategories=new ArrayCollection();
> }
>
> public function addChildCategory(c:Category):void
> {
> childCategories.addItem(c);
> }
> public function getChildren():ArrayCollection
> {
> return childCategories;
> }
> }
> }
>
> N51
>
>
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> Yahoo! Groups Links
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.