If you just have a plain ol boring object, you can loop through it with a basic for…in:
var myObj:Object = {x:1, y:5};
for (var i:String in myObj)
{
trace(i + ": " + myObj[i]);
}
However, if you have a custom value object, that doesn’t quite work. But what you can do is use describeType() to create an XMLList version on your VO.
var vo : SearchVO = data.getBody() as SearchVO;
// create an XMLList version of the VO
var varList:XMLList = describeType(vo)..variable;
// loop through the property list
for(var i:int; i < varList.length(); i++){
// output the property name and value
trace(varList[i].@name+':'+ vo[varList[i].@name]);
}
I remember hitting this before — after binding some data to a DataGrid (or any ListBase subclass) no matter where I rolled over the DataGrid only the last row was being highlighted.
After remembering that these ListBase classes rely on a unique id (uid) for each row/object, I started digging around and found that in my case, I was binding to VO’s which I had given a ‘uid’ property. This was interfering simply because I hadn’t yet hooked up that uid property so it wasn’t yet containing a unique id. So every row had the same unique id causing the DataGrid to essentially think it had only one row.
There are definitely other scenarios when something similar would happen. There’s more info here.
Until Flex 4 halo components use Flash Player 10 FTE based text (remembering that FTE is only compatible with CFF embedded fonts), you’ll have to also specify embedAsCFF=’false’ because the legacy Flash Player TextField based text cannot use CFF embedded fonts.
Additionally Spark skins for halo components now use the plain font instead of bold.
There’s currently no way to convert a Vector to an Array (or ArrayCollection), so here’s a simple util that’ll do it. Accepts any type within the Vector, so the parameter is just an Object, then we convert it back to a vector before the Array conversion. Phew.
public static function VectorToArray( v:Object ):Array
{
var vec : Vector.
Usually when you need to allow a swf on one server access to data on another domain you would put a crossdomain.xml file in the root folder of that server.
I’ve found one exception which is if you are making a call to Rails the crossdomain.xml file to the ‘public’ folder of your Rails project.
Once you have a ColdFusion CFC you can call it’s methods with a RemoteObject or via a WebService.
RemoteObjects are usually preferred for their performance speed.
Here we’ll create a super basic example of calling a CFC from both a WebService and a RemoteObject. The application will simply let you enter your name, click a button, call the CFC and return a welcome message including your name.
Join us for the Adobe Online Developer Week which already under way! http://adobe.com/go/2008_developer_week
There are a bunch of cool sessions about Flex, AIR, LCDS and more…