Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Kenneth Kawamoto

May be this is what you after?

trace("Full games: " + games.game.(user.length() == 3).length());
trace("Vacant games: " + games.game.(user.length() < 3).length());

// Trace
Full games: 1
Vacant games: 2

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Alexander Farber wrote:

Hello,

my server delivers XML data over socket,
representing games, with up to 3 players in each.

In my custom component I'd like to display
a summary: total number of games,
number of full games (3 players)
number of vacant games (joinable, because less than 3 players).

I've prepared a reduced test case demonstrating my problem:

var games:XML =
  

  
  
  


  
  


  
  

  ;

trace("All games: " + games.game.length());
trace("Full games: " + games.game.user.(length() == 3).length());
trace("Vacant games: " + games.game.user.(length() < 3).length());

It prints wrong results for the 2 last calculations:

All games: 3
Full games: 0
Vacant games: 7

And a warning:

Warning: 1060: Migration issue: The method length is no longer
supported.  Use the length property of the argument instead..

Please advise me
Alex

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Nathan Mynarcik
Yeah you should add attributes to your game nodes to seperate them:

var games:XML =
 
   
 
 
 
   
   
 
 
   
   
 
 
   
 ;

then you can use E4X to find the actually amount of users in each game:

**Pseudo Code**
games.game(@id == "1").user.length();

Nathan Mynarcik
nat...@mynarcik.com
254.749.2525
www.mynarcik.com


On Thu, Aug 19, 2010 at 1:18 PM, Glen Pike wrote:

> Hi,
>
>   I am not sure you can count the sub-nodes without having some sort of
> differentiator between parent nodes.
> You might have to loop through the list of games to find how many users
> are in each one as your tests for 2 & 3 are returning the total number of
> "user" nodes in the tree.
>
>   You can test your e4x stuff quite nicely here:
>
>   http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/
>
>   Glen
>
>
> Alexander Farber wrote:
>
>> Hello,
>>
>> my server delivers XML data over socket,
>> representing games, with up to 3 players in each.
>>
>> In my custom component I'd like to display
>> a summary: total number of games,
>> number of full games (3 players)
>> number of vacant games (joinable, because less than 3 players).
>>
>> I've prepared a reduced test case demonstrating my problem:
>>
>> var games:XML =
>>  
>>
>>  
>>  
>>  
>>
>>
>>  
>>  
>>
>>
>>  
>>  
>>
>>  ;
>>
>> trace("All games: " + games.game.length());
>> trace("Full games: " + games.game.user.(length() == 3).length());
>> trace("Vacant games: " + games.game.user.(length() < 3).length());
>>
>> It prints wrong results for the 2 last calculations:
>>
>> All games: 3
>> Full games: 0
>> Vacant games: 7
>>
>> And a warning:
>>
>> Warning: 1060: Migration issue: The method length is no longer
>> supported.  Use the length property of the argument instead..
>>
>> Please advise me
>> Alex
>> ___
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Glen Pike

Hi,

   I am not sure you can count the sub-nodes without having some sort 
of differentiator between parent nodes.
  
   You might have to loop through the list of games to find how many 
users are in each one as your tests for 2 & 3 are returning the total 
number of "user" nodes in the tree.


   You can test your e4x stuff quite nicely here:

   http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/

   Glen

Alexander Farber wrote:

Hello,

my server delivers XML data over socket,
representing games, with up to 3 players in each.

In my custom component I'd like to display
a summary: total number of games,
number of full games (3 players)
number of vacant games (joinable, because less than 3 players).

I've prepared a reduced test case demonstrating my problem:

var games:XML =
  

  
  
  


  
  


  
  

  ;

trace("All games: " + games.game.length());
trace("Full games: " + games.game.user.(length() == 3).length());
trace("Vacant games: " + games.game.user.(length() < 3).length());

It prints wrong results for the 2 last calculations:

All games: 3
Full games: 0
Vacant games: 7

And a warning:

Warning: 1060: Migration issue: The method length is no longer
supported.  Use the length property of the argument instead..

Please advise me
Alex
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Alexander Farber
Hello,

my server delivers XML data over socket,
representing games, with up to 3 players in each.

In my custom component I'd like to display
a summary: total number of games,
number of full games (3 players)
number of vacant games (joinable, because less than 3 players).

I've prepared a reduced test case demonstrating my problem:

var games:XML =
  

  
  
  


  
  


  
  

  ;

trace("All games: " + games.game.length());
trace("Full games: " + games.game.user.(length() == 3).length());
trace("Vacant games: " + games.game.user.(length() < 3).length());

It prints wrong results for the 2 last calculations:

All games: 3
Full games: 0
Vacant games: 7

And a warning:

Warning: 1060: Migration issue: The method length is no longer
supported.  Use the length property of the argument instead..

Please advise me
Alex
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] OT: FDT 4.0 M4

2010-08-19 Thread Karim Beyrouti
Hello list - 

Cannot sign up to "bugs.powerflasher.com/jira" - Captcha seems to be having 
problems. tried using Firefox / Chrome and Safary ( and on PC too ) - could not 
sign up to submit bug. Contacted the FDT team, but no reply yet... 

anyway thought i'd post it here - in case someone from powerflasher sees it:

Bug: AIR not compiling when using file.extension - FDT 4.0 Pro Milestone 4 - ( 
4.0.0.1140 ):

ERROR /Users/karim/Documents/workspace/FileTest/src/FileTestMain.as[12:13]:
Access of possibly undefined property extension through a reference with static 
type flash.filesystem:File.

Code:

package {
import flash.filesystem.File;
import flash.display.Sprite;

/**
 * @author karim
 */
public class FileTestMain extends Sprite {
public function FileTestMain() {

var f : File = new File( 
File.desktopDirectory.nativePath );
trace( f.extension ) 
}
}
}




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Question FP10 inactive event dispatched when not visible.

2010-08-19 Thread Glen Pike




It is a special event. It is one of the few broadcast events. The 
manual is quite clear on this. It is not dispatched for focus issues.
Think I have been looking at the old AS3 reference - it is clear in the 
docs for CS5, but Flash 9.0 ref is less verbose.  Sorry, I understand 
the broadcast thing fully now :-!

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders