I am using Flex 4 and for some reason I cannot get the following code to work that happens inside the ListEvent handler for dataGrid:
_tempRule = DataGrid(event.currentTarget).selectedItem as Rule;
A rule is a custom class, and the above code always returns null. The dataprovider for a datagrid is an ArrayCollection. If I try to wrap the above code, do the following:
DataGrid(event.currentTarget).selectedItem as Rule
I get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert Object@e15a971 to com.mycompany.arcc.business.Rule
Now I know that I did this before with native Flex classes such as Button, etc., but this is my case, this will not work.
Here is the rule class:
package com.mycompaany.arcc.business
{
import flash.utils.describeType;
import mx.collections.ArrayCollection;
[Bindable]
public class Rule extends Object
{
public static const RANGE:String = "Range";
public static const SINGLE:String = "Single";
public static const LIST:String = "List";
private var _name:String;
private var _group:String;
private var _groupDescription:String;
private var _description:String;
private var _values:ArrayCollection;
private var _numValues:int;
private var _type:String;
public function Rule(name:String=null, group:String=null, description:String=null, values:ArrayCollection=null, numValues:int=0, type:String=null)
{
super();
_values = new ArrayCollection();
this._name = name
this._group = group;
this._description = description;
if (values)
{
this._values = values;
}
this._numValues = numValues;
this._type = type;
}
}
}
So what am I missing?
source
share