Alex

I don't know I'm not really all that used to e4x. have you tried tracing
each step when running in debug?

as in
trace (_xlist.toString());
trace (_xlist.game.toString());
trace (_xlist.game.length.toString());

On Sun, Aug 22, 2010 at 1:13 AM, Alexander Farber <
[email protected]> wrote:

>
>
> Hello Wesley,
>
>
> On Sun, Aug 22, 2010 at 12:47 AM, Wesley Acheson
> <[email protected] <wesley.acheson%40gmail.com>> wrote:
> > This means that your listening to a change in a subsequently unbound
> collection.
>
> oh ok thanks, this makes sense.
>
> In that case I probably don't need any events at all,
> because I read the XML data over XMLSocket and
> assign that data again and again to a variable.
>
> But I'm still perplexed, why do I have
> "All/Full/Vacant games: 0" in my test code below?
>
>
> Games.mxml:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns:my="*">
>
> <mx:Script>
> <![CDATA[
> private var _xlist:XMLList;
>
>
> public function get xlist():XMLList {
> return _xlist;
> }
>
> public function set xlist(x:XMLList):void {
> _xlist = x;
> trace("set(" + x +")");
> list.dataProvider = x;
> all.text = "All games: " + _xlist.game.length();
> full.text = "Full games: " + _xlist.game.(user.length() == 3).length();
> vacant.text = "Vacant games: " + _xlist.game.(user.length() < 3).length();
> }
>
> private function gameLabel(item:Object):String {
> return "game: " + it...@label;
> }
> ]]>
> </mx:Script>
>
> <mx:Label id="all" text="All games"/>
> <mx:Label id="full" text="Full games"/>
> <mx:Label id="vacant" text="Vacant games"/>
>
> <mx:List id="list" labelFunction="gameLabel"/>
>
> </mx:VBox>
>
> MyTest.mxml:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns:my="*">
> <mx:Script>
> <![CDATA[
> import mx.events.*;
>
> private function changeXML1():void {
> games = <games>
> <game label="1">
> <user/>
> <user/>
> <user/>
> </game>
> <game label="2">
> <user/>
> <user/>
> </game>
> <game label="3">
> <user/>
> <user/>
> <user/>
> </game>
> </games>;
> }
>
> private function changeXML2():void {
> games = <games>
> <game label="A">
> <user/>
> <user/>
> <user/>
> </game>
> <game label="B">
> <user/>
> <user/>
> </game>
> <game label="C">
> </game>
> </games>;
> }
> ]]>
> </mx:Script>
>
> <mx:XML id="games">
> <games>
> <game label="X">
> <user/>
> <user/>
> </game>
> <game label="Y">
> <user/>
> <user/>
> </game>
> </games>
> </mx:XML>
>
> <mx:Button label="Change XML 1" click="changeXML1()"/>
> <mx:Button label="Change XML 2" click="changeXML2()"/>
> <my:Games xlist="{games.game}"/>
> </mx:Application>
>
> Regards
> Alex
>  
>

Reply via email to