yeah, should be able to use outerDocument too, but in reality that may not
be so good, eh?  If the datagrid id changes or some such, things break.
Events are probably the way to go.   Though if the deadline is tomorrow I'd
probably cheat :)


Dk

On 3/13/07, Jeffry Houser <[EMAIL PROTECTED]> wrote:
>
>   I think I've experimented with both of those methods, but for some
> reason didn't use them.
>
>   In the second, with the script block inside the component, you
> cannot access "datagrid.selectedIndex" or
> "datagrid.selectedItem".  In a delete function for instance you never
> know what item you're supposed to be deleting.  I suppose you might
> tell me you could do "outerDocument.datagrid.selectedIndex" and some
> such?  You might be right.
>
>   I don't remember what my problems were with outerDocument, but
> ended up using the approach I described below.
>
> At 11:22 AM 3/13/2007, you wrote:
> >Actually, this can be accomplished.
> ><mx:Button label="" icon="@Embed('../images/delete
> > >
> > > .png')"
> > > click="outerDocument.someFunction( event )" />
> >
> >
> >
> >Also note that you can add script block to a inline renderer
> >
> ><mx:DataGridColumn headerText="delete" textAlign="center"
> editable="false">
> ><mx:itemRenderer>
> ><mx:Component>
> ><mx:VBox horizontalAlign="center">
> ><mx:Script>
> >.....AS code
> ></mx:Script>
> ><mx:Button label="" icon="@Embed('../images/delete.png')" />
> ></mx:VBox>
> ></mx:Component>
> ></mx:itemRenderer>
> ></mx:DataGridColumn>
> >
> >HTH
> >DK
> >
> >
> >On 3/13/07, Jeffry Houser <[EMAIL PROTECTED] > wrote:
> > >
> > >   The inline component appears to be treated as a completely separate
> > > entity in my tests.  IT cannot call functions within it's parent.
> > >
> > >   First add an event into the in-line component and make sure that it
> > > bubbles.  The second Boolean value sets the event to bubble.  Bubbble
> > > just means that if the event is not handled, it is broadcast up to
> > > it's parent's parent until it is handled.
> > >
> > > <mx:Component>
> > > <mx:Metadata>
> > > [Event(name="Delete", type="flash.events.Event ")]
> > > </mx:Metadata>
> > > <mx:VBox horizontalAlign="center">
> > > <mx:Button label="" icon="@Embed('../images/delete.png')"
> > > click="dispatchEvent(new Event('Edit',true));" />
> > > </mx:VBox>
> > > </mx:Component>
> > >
> > >   Because of the nature of buttons inside a data grid, the 'delete'
> > > event will not be explicitly available on the datagrid.  But, you can
> > > manually create a listener for it.  I do that in an CreationComplete
> > > method, like this:
> > >
> > > public function onCreationComplete():void{
> > >   DG.addEventListener('Delete', deleteRow);
> > > }
> > >
> > >   wher e"DG" is the id of your datagrid.  put the deleteRow function
> > > in your parent component just like normal.
> > >
> > > At 01:48 AM 3/13/2007, you wrote:
> > > >Inside of an mxml file, I have a datagrid, with a Button item
> > > >renderer as such:
> > > >
> > > >
> > > ><mx:DataGridColumn headerText="delete" textAlign="center"
> > > editable="false">
> > > ><mx:itemRenderer>
> > > ><mx:Component>
> > > ><mx:VBox horizontalAlign="center">
> > > ><mx:Button label="" icon="@Embed('../images/delete.png')" />
> > > ></mx:VBox>
> > > ></mx:Component>
> > > ></mx:itemRenderer>
> > > ></mx:DataGridColumn>
> > > >
> > > >
> > > >In that Button, I would like to call a function that exists in the
> > > >same .mxml file
> > > >
> > > >
> > > >public function deleteRow( data:XML ):void{
> > > >
> > > >
> > > >}
> > > >
> > > >
> > > >
> > > >Unfortunately, if I edit the button to read like:
> > > >
> > > ><mx:Button label="" icon="@Embed('../images/delete.png')"
> > > >click="deleteRow( data );" />
> > > >
> > > >It writes that the function deleteRow doesn't exist, which I imagine
> > > >is a scope problem.  How do I get around this?
> > > >
> > > >Thanks in advance,
> > > >Alex
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/

Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:3732
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37

Reply via email to