Monday, March 22, 2010

Flex package

hi :)



i keep getting this error:





1119: Access of possibly undefined property categories
through a reference with static type Class. AOHotSpot.mxml
AOHotSpot line 35 May 11, 2007 3:55:13 PM 221



i'v never tried classes in Flex before, but basically what i
want to try and do is define categories in a class, and have the
maina pplication populate a combo box based on it.



here is my main application code:



[code]

%26lt;?xml version=''1.0'' encoding=''utf-8''?%26gt;

%26lt;mx:Application xmlns:mx=''
http://www.adobe.com/2006/mxml''


layout=''absolute''

backgroundGradientColors=''[#92abd1, #206d93]''

xmlns:local=''*'' %26gt;



%26lt;mx:Script%26gt;

%26lt;![CDATA[

import mx.controls.Label;

import flash.net.navigateToURL;





]]%26gt;

%26lt;/mx:Script%26gt;



%26lt;mx:Panel width=''70%'' height=''70%'' layout=''absolute''
horizontalCenter=''0'' verticalCenter=''-7.5''%26gt;

%26lt;mx:HBox width=''80%'' height=''33'' horizontalAlign=''center''
verticalAlign=''middle'' top=''0'' horizontalCenter=''-0.5''%26gt;

%26lt;mx:Label text=''AO Hotspot Category:''
fontWeight=''bold''/%26gt;

%26lt;mx:ComboBox%26gt;%26lt;/mx:ComboBox%26gt;

%26lt;mx:ComboBox

id=''employeeDepartment''

dataProvider=''{AOCat.categories}''

selectedIndex=''{AOCat.category}''

change=''{AOCat.category=employeeDepartment.selectedIndex;}''

/%26gt;





%26lt;/mx:HBox%26gt;

%26lt;mx:List width=''80%'' height=''227'' horizontalCenter=''0''
y=''41''%26gt;%26lt;/mx:List%26gt;

%26lt;/mx:Panel%26gt;



%26lt;/mx:Application%26gt;

[/code]



and my package looks like this:

[code]

package

{

public class AOCat

{

private var _category:uint = 0;





[Bindable]

public var modelValid:Boolean = false;



[Bindable]

public var categories:Array;

public function AOCat()

{

categories =

[

''test'', ''test2'', ''test3''

];

}







[Bindable]

public function get category():uint

{

return _category;

}



public function set category(category:uint):void

{

_category = category;

}





public function get categoryName():String

{

return categories[_category];

}





}

}



[/code]



do i need some sort of a include or something?

please ehlp :(Flex package
Hi, please write me the line no.35. where is it located?



Also what i see here is, dataProvider=''{AOCat.categories}''

selectedIndex=''{AOCat.category}''



you are calling Class Name.field name and property name. you
should create object for class AOCat. Then use that object to call
field or property name.



As ''categories'' %26amp; category is not static field or
property, you can not use

AOCat.categories

AOCat.category



That is why you are getting the error messge.



I think you create object like var myobj:AOCat=new AOCat();



No comments:

Post a Comment