holy event bubbles batman! I knew it had something to do with the fact that it was a string. I tried playing with eval(). I had no idea you could ref vars using bracket notation in AS though. obviously I'm a n00b.
danke flexdaddy. DK On 7/26/05, Andrew Spaulding <[EMAIL PROTECTED]> wrote: > The problem here is selectedItem.value is a String and is being > treated like a String. Yet in your controller it is declared as the > variable name. So rather than passing the string reference into > broadCast event, why not use the selectedItem.value as a reference to > the variable name in the Controller. Like this: > > > <mx:List width="100%" height="100%" change="getRpt( event );"> > <mx:dataProvider> > <mx:Array> > <mx:Object label="Current Open Bugs" > value="EVENT_GET_ALL_OPEN_BUGS" /> > <mx:Object label="All Bugs" > value="EVENT_GET_ALL_BUGS" /> > </mx:Array> > </mx:dataProvider> > </mx:List> > > ----change event ---- > public function getRpt( event:Object ) : Void > { > mx.controls.Alert.show( event.target.selectedItem.value, "choice" ); > EventBroadcaster.getInstance().broadcastEvent(BugTrackerController[event.target.selectedItem.value]); > } > > I've tested this and it broadcasts the appropriate event. > > Hope this helps, > > Andrew Spaulding > www.flexdaddy.info > > > > > > --- In flexcoders@yahoogroups.com, Douglas Knudsen > <[EMAIL PROTECTED]> wrote: > > so, I have a list. The change event calls the function below. I want > > a click on an item to broadcast an event, using cairngorm by the way. > > I can't seem to get it to work. The Alert tells me the event name is > > coming in correctly, but nothing is happeing. I hardcoded the event > > to BugTrackerController.EVENT_GET_ALL_BUGS, and things work fine. So > > I know the approach is correct. > > > > <mx:List width="100%" height="100%" change="NavPanelViewHelper.getRpt( > > event );"> > > <mx:dataProvider> > > <mx:Array> > > <mx:Object label="Current > > Open Bugs" > > value="BugTrackerController.EVENT_GET_ALL_OPEN_BUGS" /> > > <mx:Object label="All Bugs" > > value="BugTrackerController.EVENT_GET_ALL_BUGS" /> > > </mx:Array> > > </mx:dataProvider> > > </mx:List> > > > > ----change event ---- > > public function getRpt( event : Object ) : Void { > > > mx.controls.Alert.show(event.target.selectedItem.value,"choice",mx.controls.Alert.OK); > > EventBroadcaster.getInstance().broadcastEvent( > > event.target.selectedItem.value)); > > } > > > > -- > > Douglas Knudsen > > http://www.cubicleman.com > > this is my signature, like it? > > > > > -- > 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 > > > > > > > > -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? -- 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/