Why the heck do you need to re-cast as an XMLListCollection?

This is a actually really simple...

var squat:XML = XML(squaresGrid.selectedItem);
var myValue:String = squ...@myproperty OR squat.myProperty (depending on if 
it's a node or attribute)

It does work. I've done it hundreds of times.  Don't know what you're doing 
wrong...

-Julian




________________________________
From: Dan Pride <[email protected]>
To: [email protected]
Sent: Sat, November 21, 2009 11:43:34 AM
Subject: Re: [flexcoders] Syntax Question

   
Thanks for the response.
Its an ArrayCollection of XML objects.

var squat:XMLList = squaresGrid. selectedItem. NameCol;
will trace as an XML List but I can not seem to get the list
to then recast as an XMLListCollection so I can get at it.
   
Thanks
Dan

--- On Sat, 11/21/09, Julian Alexander <wb...@ymail. com> wrote:


>From: Julian Alexander <wb...@ymail.. com>
>Subject: Re: [flexcoders] Syntax Question
>To: flexcod...@yahoogro ups.com
>Date: Saturday, November 21, 2009, 11:14 AM
>
>
>>
>
>
>
>  >
>
> 
>>      
> 
>Dan,
>
>The problem (I assume) is that the object you're getitng back isn't XML.  I 
>was using that as an example, but when you use the "as" operator if the object 
>isn't that type it will always return null.
>
>What is your data provider?  Is it an array of objects? XML? It all depends on 
>what you're doing.  Either way, it's based on a list.  Getting the selected 
>item will give you a generic "object" that you need to cast to whichever data 
>type (actually, you don't have to but it's nicer) at which point you have all 
>of the properties accessible and you can grab the same property that the first 
>column is bound to.
>
>-Julian
>
>
>
>
________________________________
From: Dan Pride <danielpride@ yahoo.com>
>To: flexcod...@yahoogro ups.com
>Sent: Sat, November 21, 2009 7:42:28 AM
>Subject: Re: [flexcoders] Syntax Question
>
>  >
>
> 
>>      
> 
>Julian... Apparently you are wrong?
>
>When I do it with an untyped var I get an object with an XMLList for each grid 
>column
>   var squat = dataGrid.selectedIt em;
>
>This
>var myValue:XML = dataGrid.selectedIt em as XML;
>returns null for myValue
>
>Why is it such Rocket Science to get the first value in a column?
>Very frustrating for something that should be so simple.
>
>Thanks for the help
>Dan
>
>--- On Fri, 11/20/09, Julian Alexander <wb...@ymail. com> wrote:
>
>
>>From: Julian Alexander <wb...@ymail. com>
>>Subject: Re:
>> [flexcoders] Syntax Question
>>To: flexcod...@yahoogro ups.com
>>Date: Friday, November 20, 2009, 10:53 PM
>>
>>
>>>>
>>
>>
>>
>>  >>
>>
>> 
>>>>      
>> 
>>You can't access the value from the column name - getting the selected value 
>>will give you the entire row that the datagrid is displaying from which you 
>>can get the value you're looking for.  In other words, if you have an XMLList 
>>as your dataProvider, you can do something like:
>>
>>var myValue:XML = dataGrid.selectedIt em as XML;
>>var myName:String = myval...@name.
>>
>>Make sense?
>>
>>-Julian
>>
>>
>>
>>
________________________________
From: Dan Pride
>> <danielpride@ yahoo.com>
>>To: flexcod...@yahoogro ups.com
>>Sent: Fri, November 20, 2009 9:43:33 PM
>>Subject: [flexcoders] Syntax Question
>>
>>  >>
>>
>> 
>>>>      
>> 
>>On Creation complete I am filling a datagrid and I want to select the first 
>>value listed from the Name Column (NameCol)
>>
>>>>What is the syntax?
>>>>dataGrid.selectedIn dex = 0;
>>>>Value = dataGrid.selectedIt em.NameCol;
>>
>>>>Does not work. why not?
>>
>>>>Thanks
>>>>Dan
>>
>>
>> 
>
> 


Reply to sender | Reply to group Messages in this topic (6) 
Recent Activity:        * New Members 34   
Visit Your Group Start a New Topic 
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
MARKETPLACE
Parenting Zone: Find useful resources for a happy, healthy family and home
 
Switch to: Text-Only, Daily Digest • Unsubscribe • Terms of Use
. 

__,_.._,___ 


      

Reply via email to