Hi,

If you want to call a method of the parent MXML, dont create a new instance
of it (like you have done by creating a new instance of WhatsOnAdminView.)
Just refer to the method using "parentDocument". So just remove the code
where you instantiate the variable "obj". And change the line
"obj.cmdView_click()" to "parentDocument.cmdView_click();".

Regards,
Venkat
www.venkatv.com

On Wed, Sep 24, 2008 at 3:08 PM, Hitesh <[EMAIL PROTECTED]> wrote:

>
> Hi there,
>
> There is an issue working with button click event. The button is put
> within DATAGRID as a column AND I have to fetch ID for whichever row
> the button is clicked.
>
> Here is the more details.
> ==================
>
> There is a MXML page named "WhatsOnAdminView.mxml".
> In this page there is a method like this.
> ..
> ..
> <mx:Script>
> public function cmdView_click():void
> {
>         Alert.show(grdWhatsOn.selectedIndex.toString());
> }
> </mx:Script>
> ..
> ..
> <mx:DataGrid x="10" y="271" id="grdWhatsOn" height="130" width="698">
> <mx:columns>
>        <mx:DataGridColumn headerText="Event" dataField="title"
> width="350"/>
>        <mx:DataGridColumn headerText="Type" dataField="articaltypeName"
> width="100"/>
>        <mx:DataGridColumn headerText="Date" dataField="createdDate"
> labelFunction="dateFormat" width="100"/>
>        <mx:DataGridColumn width="148" headerText="View Details"
> textAlign="center">
>                <mx:itemRenderer>
>                        <mx:Component>
>                                <mx:HBox horizontalAlign="center" xmlns:mx="
> http://www.adobe.com/
> 2006/mxml <http://www.adobe.com/2006/mxml>">
>                                <mx:Script>
>                                     <![CDATA[
>                                        import view.admin.WhatsOnAdminView;
>                                        private var obj:WhatsOnAdminView =
> new WhatsOnAdminView();
>                                        private function
> btnClickAction():void{
>                                           obj.cmdView_click();
>                                        }
>                                     ]]>
>                             </mx:Script>
>                                <mx:Button label="Open"
> click="btnClickAction()" width="80"/>
>                             </mx:HBox>
>                        </mx:Component>
>                </mx:itemRenderer>
>        </mx:DataGridColumn>
> </mx:columns>
> </mx:DataGrid>
> ..
> ...
> ..
> In above MXML code look at datagrid code.
>
> There is a 4th column named VIEW DETAILS. For this column I have put
> OPEN button as a value for each row. Upon clicking this button I have
> to fetch ID (primary key) that was bound with grid during page load.
> You would see that finally I am calling the same page cmdView_click()
> method to work with grid.
>
> But when I click on button I get following error.
>
> "TypeError: Error #1009: Cannot access a property or method of a null
> object reference."
>
> Can somebody advise how to resolve this error?
>
>
> Thanks in advance.
> Regards.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to