I'm trying to convert mxml to AS3and have what appear to be two identical
(except for their placement) instances of a datagrid. The one using mxml works.
The one using AS3 does not. The only difference I can see is the use of the
curly braces in the component, but I thought that was accounted for by making
the instance Bindable. What is wrong with the AS3 implementation?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="absolute" creationComplete="init()" >
<mx:Script>
<![CDATA[
import mx.collections.ListCollectionView;
import mx.collections.XMLListCollection;
[Bindable] public var people:XMLListCollection
[Bindable] public var studentsDataGrid:MyDataGrid
[Bindable] private var myXmlList:XMLListCollection
[Bindable] private var myXml:XML;
public function init():void{
var myXml:XML =
<myXml>
<employee>
<name>Fred</name>
</employee>
<employee>
<name>Andy</name>
</employee>
</myXml>;
myXmlList=new XMLListCollection
myXmlList.source=myXml.employee
studentsDataGrid=new MyDataGrid();
studentsDataGrid.dataProvider=myXmlList;
studentsDataGrid.x=100
studentsDataGrid.y=50
}
]]>
</mx:Script>
<MyDataGrid id="studentsDataGrid2" dataProvider="{myXmlList}" x="300" y="50"/>
</mx:Application>
Class:
<?xml version="1.0" encoding="utf-8"?>
<mx

ataGrid xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:columns >
<mx

ataGridColumn width="85" dataField="name" />
</mx:columns>
<mx:Script>
<![CDATA[
public function init():void{
trace("here")
}
]]>
</mx:Script>
</mx

ataGrid>