Welcome, Guest. Please login or register.
Did you miss your activation email?
08 Sep 2010, 04:34:59 UTC
Forum home
+  flexdeveloper.eu Forum
|-+  Flex and ActionScript 3.0
| |-+  Flex Builder, Flash Builder & Eclipse (Moderators: JMWhittaker, Jan K, thewarpedcoder, James)
| | |-+  Click Event of Images in a DataGrid
« previous next »
Pages: [1] Print
Author Topic: Click Event of Images in a DataGrid (Read 666 times)
kiratjohal
Newbie FD
*
Posts: 36


« on: 26 Nov 2009, 11:04:28 UTC »

Hi,

I am using DataGrid component in my flex web Application. I am loading images in one of its column, means each row has an image. I have added a click event to the image. Last row's image click handler is working but the above images when clicked gives error as:

Quote
TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at mx.controls::DataGrid/mouseDownHandler()
[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:4314]


I have used ItemRendered to add image as:
Code:
<mx:DataGridColumn  headerText="    " width="30" dataField="Tendency" textAlign="center" >
         <mx:itemRenderer>
    <mx:Component>
                <mx:Image source="assets/images/plus.png" name="status" height="19" width="19" click="outerDocument.fnImageClicked()" />
             </mx:Component>
         </mx:itemRenderer>
      </mx:DataGridColumn>

I have tried the both with flex 3.0.0 and 3.3.1.Flash player version 10
I am doing anything wrong?
« Last Edit: 26 Nov 2009, 11:29:28 UTC by flexy » Logged
sathish
Newbie FD
*
Posts: 72


« Reply #1 on: 06 Jan 2010, 11:53:28 UTC »

create public function in script block

public function fnImageClicked():void{
}

on image click

this.parentDocument.fnImageClicked().


it will work
Logged
Pages: [1] Print
« previous next »
Share this on: Twitter Twitter Del.icio.us del.icio.us Digg Digg
Jump to:

©2006-2010 Flexdeveloper.eu/Jodie O'Rourke. All rights reserved.
Adobe®, Adobe® Flash™, Adobe® AIR™ and Adobe® Flex™ are registered trademarks of Adobe Systems Incorporated in the United States and other countries. All rights reserved.

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC