Iv'e lost you.  If this is no longer about bubbling and catching events,
start a new thread.

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of stevepruitt97
Sent: Friday, February 13, 2009 1:34 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: how to bubble and catch events

 

I have bigger problems. By changing the events to standard ADD and 
REMOVE and modifying

<mx:DataGrid id="templateGrid" width="100%" height="100%" 
rowCount="5" dataProvider="{_content}" click="onTemplateSelected
(event)" add="onAdd(event)" remove="onRemove(event)">

I at least got past the compile problems. I am now trying to select 
the view choices in the ViewStack with

actionColumn.selectedIndex = 1;

But actionColumn is not visible at the top level. This is my first 
foray into embedded components and trying to inline renderers. I may 
have to break down and start customizing.

Thanks in advance.

-S

<mx:DataGrid id="templateGrid" width="100%" height="100%" 
rowCount="5" dataProvider="{_content}" click="onTemplateSelected
(event)" add="onAdd(event)" remove="onRemove(event)">
<mx:columns>
<mx:DataGridColumn id="actionColumn" headerText="Action">
<mx:itemRenderer>
<mx:Component>
<mx:ViewStack id="actionChoices">
--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <tspr...@...> wrote:
>
> That should work, the second argument in the event constructor 
makes it
> bubble.
> 
> 
> 
> I don't see your listener defined. You should do that in a function
> called on creation complete of the application:
> 
> this.addEventListener(Event.ADDED, onAction)
> 
> 
> 
> Tracy Spratt 
> Lariat Services 
> 
> Flex development bandwidth available 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of stevepruitt97
> Sent: Friday, February 13, 2009 12:08 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] how to bubble and catch events
> 
> 
> 
> I have the following scenario. I need to catch the click events for 
> either of the two buttons. I tried putting the event handler on the 
> DataGrid, but I'm getting an unresolved error for it. Is this even 
> possible?
> 
> Thanks in advance for any help.
> 
> -S
> 
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> 
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > ">
> <mx:Script>
> <![CDATA[
> import mx.collections.ArrayCollection;
> import 
> mx.controls.dataGridClasses.DataGridItemRenderer;
> 
> [Bindable]
> private var _content : ArrayCollection = new 
> ArrayCollection();
> 
> :
> :
> 
> private function onAction(event : Event) : void
> {
> trace("got action: " + event.target.id);
> }
> ]]>
> </mx:Script>
> <mx:DataGrid id="templateGrid" width="100%" height="100%" 
> rowCount="5" dataProvider="{_content}" action="onAction(event)">
> <mx:columns>
> <mx:DataGridColumn id="actionColumn" headerText="Action">
> <mx:itemRenderer>
> <mx:Component>
> <mx:ViewStack>
> <mx:Metadata>
> [Event(name = "action", type 
> = "flash.events.Event")]
> </mx:Metadata>
> <mx:Script>
> <![CDATA[
> private function onAction(event : 
> Event) : void
> {
> trace("action: " + event.target.id);
> var e : Event;
> 
> if(event.target.id == "adder")
> e = new Event(Event.ADDED, 
> true);
> if(event.target.id == "deleter")
> e = new Event(Event.REMOVED, 
> true);
> 
> dispatchEvent(e);
> }
> ]]>
> </mx:Script>
> <mx:Text text=""/>
> <mx:Button id="adder" label="Add" 
> click="onAction(event)"/>
> <mx:Button id="deleter" label="Delete" 
> click="onAction(event)"/>
> </mx:ViewStack> 
> </mx:Component>
> </mx:itemRenderer>
> </mx:DataGridColumn>
> <!--mx:DataGridColumn dataField="index" headerText="ID"/--
> >
> <mx:DataGridColumn dataField="title" 
> headerText="Template"/>
> <mx:DataGridColumn dataField="description" 
> headerText="Description"/>
> <mx:DataGridColumn dataField="version" 
> headerText="Version"/>
> </mx:columns>
> </mx:DataGrid>
> </mx:Canvas>
>



Reply via email to