Groups | Blog | Home
all groups > flash actionscript > september 2006 >

flash actionscript : Datagrid Component



indigomontoya
9/23/2006 7:01:51 PM
Hi need to know how to look at specific rows in a datagrid.

my data grid has one column but multiple rows of info loaded from an xml file,
i need to use indexOf on specific rows how would i direct that command to
specific rows in the datagrid?
TimSymons
9/23/2006 7:19:59 PM
You can access each row in the DataGrid by using:

datgrid_instance.getItemAt(rowNumber).columnName

rowNumber : zero-based numbering
columnName : name of the column you want the data from

Not sure what the return type is (most likely an Object) so you should
probably be safe and typecast the returned value into a String.

var myRow:String = String(datagrid.getItemAt(2).label);

Tim
indigomontoya
9/24/2006 1:45:11 AM
so i tried this, it should return the index of team and the total length it
returns -1 and 9, the total length of that row (all rows actually) are well
over 9 and Team is not at -1
this.myReceiveXMLConnector.trigger();

var myRow:String = String(myDataGrid.getItemAt(1).description);

myField_txt.text = myRow.indexOf("Team");
totalLength_txt.text = myRow.length;


indigomontoya
9/25/2006 6:04:34 PM
TimSymons
9/25/2006 6:32:38 PM

Are you waiting to make sure that the XMLConnector has recieved the data?

Can you send me a link to your program? I can help more if I can see the code
you are trying to use. If not, can you send a sample of the XML file that you
are reading? I can then try to mock up to same thing and give you more explicit
help.

Tim
TimSymons
9/25/2006 6:32:38 PM

Are you waiting to make sure that the XMLConnector has recieved the data?

Can you send me a link to your program? I can help more if I can see the code
you are trying to use. If not, can you send a sample of the XML file that you
are reading? I can then try to mock up to same thing and give you more explicit
help.

Tim
indigomontoya
9/25/2006 7:06:19 PM
3rd attempt now at replying hopefully this works...

i gave up on the datagrid and am just loading it into an xml object and then
into a textbox and doing indexOf on the contents of that, and that works!!!! on
my computer.... but when i put it on my server to test it there it doesnt work,
the default winner is Red, and it should load the xml file into the textbox in
the middle of the movie, which it does when i run it from my comp. I've made
the links all approved in the security settings (seperate question: is that
possible to make default for everyone?) and it still doesnt work

http://www.coleflashdesign.com/workingscorefinder.html
http://www.coleflashdesign.com/workingscorefinder.swf
http://www.coleflashdesign.com/workingscorefinder.fla


indigomontoya
9/25/2006 7:16:03 PM
TimSymons
9/25/2006 7:19:33 PM
I will take a look at the files but in the mean time, make sure that in your
publish settings that you have set the "Local playback security" pulldown menu
under the Flash tab to "Access network only".

Tim
indigomontoya
9/25/2006 7:50:27 PM
indigomontoya
9/27/2006 6:12:30 PM
TimSymons
9/28/2006 11:39:40 PM
Sorry I didn't notice this before but I just saw that you are loading the XML
from a different domain than where you Flash movie is. This is why it will work
from your desktop in test mode and not from your server.

You are having a domain security issue. You can only read files into Flash
that on in the same domain or if you have the crossdomain.xml setup on the
server that contains the XML file you want.

Do a search in the Help Docs for: Allowing cross-domain data loading

To me, it is kind of confusing, but the basic this is that if you want cross
domain data then you have to use the crossdomain.xml file and that means you
have to have access to the server (not yours but the other one.)

Tim
AddThis Social Bookmark Button