Hi,
I am working on an application that that consists of a DataGrid in which I am using the ListEvent.ITEM_CLICK event in order to determine which column and row the user clicked on. I am using Flash Professional CS6 v12.0.0.481, coding in ActionScript 3 on a machine running Windows XP Pro 2002 SP 3 and have no issues when compiling my source code. However, when I send the source code to my client and they attempt to compile it, they get the following errors:
1119: Access of possibly undefined property ITEM_CLICK through a reference with static type Class.
1119: Access of possibly undefined property columnIndex through a reference with static type ListEvent.
1119: Access of possibly undefined property rowIndex through a reference with static type ListEvent.
My client has tried to compile the source code on a MacBook Pro and a Mac Air both running OS 10.7.4 and Flash Professional CS6 v12.0.0.481 (The same version I am running)
This application is targeted for 3 platforms: Web (Flash Player 11.x), iOS and Android and the issue occurs for a target types.
The lines of code that are causing the issues are the adding of the event handler and the access of event properties within the event handler.
_grdDataGrid.addEventListener(ListEvent.ITEM_CLICK, HandleGridItemClickEvent);
protected function HandleGridItemClickEvent(evt:ListEvent):void
{
if(evt.columnIndex == DESCRIP_COL_ID)
{
if(_aryData[evt.rowIndex].dataType == DATA_TYPE_PARENT)
{
if(_aryData[evt.rowIndex].Expand == false)
{
// Set expand flag
_aryData[evt.rowIndex].Expand = true;
// Add details
var i:int = 0;
for (i = 0; i < _aryData[evt.rowIndex].Details.length; i++)
{
_aryData.splice(evt.rowIndex + (i + 1), 0, {
Description:String(_aryData[evt.rowIndex].Details[i].label),
Catalog:String(_aryData[evt.rowIndex].Details[i].data),
Quantity:"",
rowColor:String(ROW_COLOR_DEFAULT),
rowType:String(ROW_TYPE_NONE),
dataType:int(DATA_TYPE_DETAIL),
Expandable:Boolean(false),
Expand:Boolean(false),
Details:null});
}
}
else
{
// Clear expand flag
_aryData[evt.rowIndex].Expand = false;
// Remove details
_aryData.splice(evt.rowIndex + 1, _aryData[evt.rowIndex].Details.length);
}
// Create new data provider
_dp = new DataProvider(_aryData);
_grdDataGrid.dataProvider = _dp;
}
}
// Info was clicked
else if(evt.columnIndex == QTY_COL_ID)
{
if(_aryData[evt.rowIndex].dataType == DATA_TYPE_PARENT)
{
// Navigate to info URL
var strCatalog:String = _aryData[evt.rowIndex].Catalog;
var intStart:int = (strCatalog.indexOf("href='", 0) + 6);
var intEnd:int = strCatalog.indexOf("'", intStart);
var strLink:String = strCatalog.substr(intStart, intEnd - intStart);
navigateToURL(new URLRequest(strLink),"_self");
}
}
}
I believe I have all the correct import statements because the application compiles and runs fine on my Windows machine but for completeness I will include them here.
// Imports
import flash.display.*;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.text.*;
import flash.utils.Timer;
import fl.controls.DataGrid;
import fl.controls.dataGridClasses.*;
import fl.data.DataProvider;
import fl.events.ListEvent;
Has anyone run into this issue or have any advice as how to go about resolving this? Any help would greatly be appreciated
Thanks