PDA

View Full Version : Actionscript Code Help - $100


zinch33
10-28-2011, 07:46 PM
I'm looking for someone who is really good at actionscript.

I have a sortable list that is created from XML. There are 3 columns/text boxes (unit, rate, avail). I'd like the user to click on the unit name and be taken to a specific labeled frame of the movieclip.

I've tried a couple things and ran into some issues because of the sorting.

If this is something you know how to do and can do it tonight or tomorrow (Oct 28-29) please let me know. I can pay $100.

I don't need you to set it up for all units. One is fine. I can do the rest. I'm just not advanced enough at this and need some help figuring this out.

PM me if you are interested and only if you know how to do this. I'll supply you with the FLA and XML.

Thanks in advance.

tacos
10-28-2011, 11:51 PM
Just answered your mail... ;)

arkitx
10-29-2011, 08:21 AM
@zinch33: What is your xml structure?


import fl.data.DataProvider;
import fl.controls.DataGrid;
import fl.events.ListEvent;
import fl.controls.dataGridClasses.DataGridColumn;


var dataInfo:Array=new Array(
{name:"Red Apple",unit:3,rate:45,avail:200},
{name:"Green Apple",unit:3,rate:62,avail:0},
{name:"Banana",unit:12,rate:20,avail:200},
{name:"Pinaple",unit:1,rate:45,avail:0},
{name:"Millon",unit:1,rate:85,avail:10},
{name:"Lemon",unit:1,rate:5,avail:5000},
{name:"Orange",unit:25,rate:45,avail:100}
);

var colName:Array=new Array({h:"Fruit Name",n:"name"},{h:"Rate",n:"rate"},{h:"Unit",n:"unit"},{h:"Stock",n:"avail"});

var mc:movieclip=new movieclip();
addChild(mc);
mc.stop();
mc.x=stage.stageWidth/2-mc.width/2;
mc.y=260;

// DUMMY DATA
var dp:DataProvider = new DataProvider();
for (var i:uint=0; i<dataInfo.length; i++) {
dp.addItem({name:dataInfo[i].name,rate:"$"+dataInfo[i].rate ,unit:dataInfo[i].unit, avail:avail(i)});
}
function avail(n:uint) {
return dataInfo[i].avail > 0?"yes":"nill";
}

var dg:DataGrid = new DataGrid();
var cl:DataGridColumn;

for (var c=0; c<colName.length; c++) {
cl=new DataGridColumn(String(colName[c].n));
cl.headerText=colName[c].h;
dg.addColumn(cl);
}

dg.setSize(540,160);
dg.move(stage.stageWidth/2-dg.width/2,stage.stageHeight/3-dg.height/2);
dg.dataProvider = dp;
addChild(dg);

dg.addEventListener(ListEvent.ITEM_CLICK, gridItemSelected);

function gridItemSelected(e:ListEvent):void {
mc.gotoAndStop(e.rowIndex+1);
trace( "Row Index: " + e.rowIndex);
trace( "Column Index: " + e.columnIndex);
var colItem:String = e.target.columns[e.columnIndex].dataField;
trace( "Column Field Name: " +colItem);
trace( "Cell data: " +e.item[colItem]);
}



For those who doesn't effort to spend $100.

This is exclude the xml part and for data, the code used a dummy data from dataInfo Array.

PM me if there is any bug or for other assistance.




arkitx