PDA

View Full Version : [AS3] Datagrid help


secret007
03-18-2009, 01:13 PM
I have a datagrid with three columns,

i have currently set event listener to whole datagrid like so,

this.dg.addEventListener(ListEvent.ITEM_CLICK, gotoURL);
function gotoURL(e:ListEvent):void
{
var req:URLRequest = new URLRequest("url");
navigateToURL(req, "_blank");

}

in this way when a user clicks anywhere in the datagrid it will be redirected to that url, but i want to apply this listener to my first column where all links are shown..

any help plz...

Bombdogs
03-18-2009, 01:29 PM
You're lucky I'm in a good mood today - nothing makes me want to help less than when someone shouts ASAP with exclamation marks.

Easy fix...

function gotoURL(e:ListEvent):void
{
if(e.columnIndex == 0) {
var req:URLRequest = new URLRequest("url");
navigateToURL(req, "_blank");
}
}

PMF

secret007
03-18-2009, 02:00 PM
You're lucky I'm in a good mood today - nothing makes me want to help less than when someone shouts ASAP with exclamation marks.

Easy fix...

function gotoURL(e:ListEvent):void
{
if(e.columnIndex == 0) {
var req:URLRequest = new URLRequest("url");
navigateToURL(req, "_blank");
}
}

PMF


cool man thanks for the help,

one small thing plz, i want to show handcursor only when user rollover to this column,

i use dg.buttonMode = true;

but for the column scope buttonMode property doesn't work, how to accomplish this task ??

thanx in advance ..