View Full Version : [AS2] datagrid value to button

04-27-2011, 11:30 PM

i have the following problem
i have a datagrid ,button ,dynamic text box and a xml script
the datagrid gets data from the xml file
one of the nodes of the xml is a url link
when the data is populated in the datagrid one row shows the url linkelse if(node.nodeName == "url")
obj["ALBUM"] = node.firstChild.nodeValue;
when i click on the datagrid i can see the data of a certain cell displayed in the dynamic textfield //Retrieve the cell Value in the CallType Category
var cellVal:Object = eObj.target.selectedItem.TITLE;
dtxtOutput.text = cellVal.toString();

what i am trying is 1=that the url links will not be displayed in the datagrid
2= after i click on one of the rows of the datagrid and then on the button the url link will be opened

i tried many things one of them is on (release) {

but nothing worked i hope someone whould be kind to try to help me it would be very very appreciated

this is the full actionscript it is not mine it is one i found online and edited it a bit the only thing that works is the dynamic text box

dg.setStyle("fontFamily", "comics");
dg.setStyle("headerColor", "0x00FF00");
dg.setStyle("rollOverColor", "0x00FF00");
dg.setStyle("selectionColor", "0xFF0000");
dg.getColumnAt(1).setStyle("backgroundColor", "0xFFFF00");

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = handleXML;

function handleXML(pSuccess:Boolean):Void
var dp:Array = new Array();

var dinnerNode:XMLNode = myXML.firstChild;
var singerNodes:Array = dinnerNode.childNodes;
var singerLength:Number = singerNodes.length;

for(var i:Number = 0; i < singerLength; i++)
var singerNode:XMLNode = singerNodes[i];
var singerNodeArray:Array = singerNode.childNodes;
var singerNodeLength:Number = singerNodeArray.length;

var obj:Object = new Object();

for(var j:Number = 0; j < singerNodeLength; j++)
var node:XMLNode = singerNodeArray[j];
var nodes = this.firstChild.childNodes;

if(node.nodeName == "shout")
obj["MESSAGE"] = node.firstChild.nodeValue;
else if(node.nodeName == "name")
obj["NAME"] = node.firstChild.nodeValue;
else if(node.nodeName == "url")
obj["ALBUM"] = node.firstChild.nodeValue;
else if(node.nodeName == "client")
obj["TITLE"] = node.firstChild.nodeValue;
else if(node.nodeName == "name")
obj["ARTIST"] = node.firstChild.nodeValue;
if(node.nodeName == "anno")
obj["TES"] = node.firstChild.nodeValue;


dg.dataProvider = dp;
//Let's create the event listener to our DataGrid object
var dgListener:Object = new Object();

dgListener.cellPress = function(eObj:Object) {
if(eObj.columnIndex <> 0){
var siteURL:Object = eObj.target.selectedItem.ALBUM;
my_btn.onRelease (
//Retrieve the cell Value in the CallType Category
var cellVal:Object = eObj.target.selectedItem.NAME;
dtxtOutput.text = cellVal.toString();

//Let's add the event listener to our DataGrid object