Why not set a number in this datagrid?

Hello

Flash CS5

(Keep this separate from my other thread in order not to divert too much and help others with this problem.)

I have a datagrid whose content is not pulled from an outside source, but written in the code just to test. The grid if you click above appears in a box of dynamic text on the stage, (after a section of youtube that used dynamic text) but I get:

BusRoute: undefined

Sttmnt1: Oxford

Sttmnt2: Burford

Sttmnt3: Swindon

Why not the number?  It contains the number of this title for each line is said by the way.

code is: -.

Import fl.controls.DataGrid;
import flash.events.Event;
Import fl.controls.ScrollPolicy;

var item1:Object = {BusRoute: '43', Sttmnt1: 'Oxford', Sttmnt2: 'Burford', Sttmnt3: 'Swindon'};
var item2:Object = {BusRoute: "361", Sttmnt1: "Evesham", Sttmnt2: "ChippingNorton", Sttmnt3: "Am Buckingh"};

var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.color = 000000
myTextFormat.size = 14;

var datagrid:DataGrid = new DataGrid;
DataGrid.Move (20.50);
DataGrid.Width = 200;
DataGrid.Height = 70;
datagrid.rowHeight = 35;
DataGrid.Columns is ["BusRoute", "Sttmnt1", "Sttmnt2", "Sttmnt3"];.
DataGrid.Columns [0]. Width = 30;
DataGrid.Columns [1]. Width = 70;
DataGrid.Columns [2]. Width = 70;
datagrid.resizableColumns = true;
datagrid.horizontalScrollPolicy = ScrollPolicy.ON;
datagrid.setRendererStyle ("textFormat", myTextFormat);
datagrid.addItem (item1);
datagrid.addItem (item2);

addChild (datagrid);

datagrid.addEventListener (Event.CHANGE, gridItemClick);

function gridItemClick(event:Event):void {}

DataGridSelectedRowText.text = "BusRoute:" + event.target.selectedItem.Task + "\n";
DataGridSelectedRowText.appendText ("Sttmnt1:" + event.target.selectedItem.Sttmnt1 + "\n");
DataGridSelectedRowText.appendText ("Sttmnt2:" + event.target.selectedItem.Sttmnt2 + "\n");
DataGridSelectedRowText.appendText ("Sttmnt3:" + event.target.selectedItem.Sttmnt3 + "\n");

}

Envirographics


In your objects item1 and item2 property you set first to be 'BusRoute.

var item1:Object = {BusRoute: '43', Sttmnt1: 'Oxford', Sttmnt2: 'Burford', Sttmnt 3: "Swindon"};

but in your attempt to acquire the data you seem to be referring to him as "stain".

DataGridSelectedRowText.text = "BusRoute:" + event.target.selectedItem.Task + "\n";

One of them must be changed to agree with each other.

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • Toshiba HDD utility to write zeros to the drive

    I have a big problem in my Toshiba HDD and I need a Toshiba HDD utility but is not. I'm sure a zero fill can solve my problem. Other HARD drive seagate or wester digital provides us with DOS software to solve problems, but I can find a similar softwa

  • How do l restarts my iPad

    Hello Hello you forgot secret answer to Emil Please provide me secret answer and thank you

  • Reading USB gamepad?

    LabView is a VI to read a USB Joystick/game controller.  Y at - it no support to achieve in CVI? I don't need anything more complex than the X & Y mark positions and detect keys. Google found me some MSDN info "Raw Device Input", but when I try to sa

  • How to get my cpu to read my cd player

    My cd rom is not reading the disc, I put in and when I goto the cpu page it listed in cd drive f: VZaccess Manager then how do I get it turned back on to my cpu cd player? Also, I can't my cpu to read my printer or scanner when I plug it in it he rec

  • COM Surrogate does not work on my computer. I installed all THE updates, but this still does not work. Help, please.

    I don't know what is COM Surrogate.  It lights up just on the screen and I don't know why!  He just tells me to install important updates, what I've done.