Re: [flexcoders] Can someone rewrite this...

2010-04-10 Thread Paul Andrews
On 10/04/2010 03:45, Wally Kolcz wrote: Can someone rewrite this as a switch/case? I tried, but it didn't seem to work. Problem I am running into is the multiple conditions in the case. Thanks! Wally,I didn't spot anyone mentioning this (apologies if it's already been mentioned), but all

[flexcoders] Can someone rewrite this...

2010-04-09 Thread Wally Kolcz
Can someone rewrite this as a switch/case? I tried, but it didn't seem to work. Problem I am running into is the multiple conditions in the case. Thanks! private function getAgeGroup(birthday:Date):int { var age:int = getAge(birthday); if (age = 0 age 3){ //Birth to 2

Re: [flexcoders] Can someone rewrite this...

2010-04-09 Thread Joe Cabezas
it curious but a person who are 2000 years old, with your implementation it's group 1 run this code: package { import flash.display.Sprite; public class test extends Sprite { public function test() { trace(this.getAgeGroup(2000)); } private function getAgeGroup(age:Number):int { if (age = 0

Re: [flexcoders] Can someone rewrite this...

2010-04-09 Thread Rob Romanek
This is off the top of my head in email so there may be some errors but something like this should work var category:Number; switch (true){ case(age 18): category = 0; break; case(age 15): category = 6; break;

Re: [flexcoders] Can someone rewrite this...

2010-04-09 Thread Wally Kolcz
Thanks for the try, but all ages are 18 so the first condition would be met on all of them. I need the multiple conditions on the case to be preserved. :) On 4/9/2010 11:45 PM, Rob Romanek wrote: This is off the top of my head in email so there may be some errors but something like this

Re: [flexcoders] Can someone rewrite this...

2010-04-09 Thread Wally Kolcz
Sorry, you're right. Tired and just can't seem to get my GT and LT's correct. :D On 4/9/2010 11:54 PM, Wally Kolcz wrote: Thanks for the try, but all ages are 18 so the first condition would be met on all of them. I need the multiple conditions on the case to be preserved. :) On 4/9/2010

Re: [flexcoders] Can someone rewrite this...

2010-04-09 Thread Joe Cabezas
y did not understand, but i hope i help you 2010/4/9 Wally Kolcz wko...@isavepets.com Thanks for the try, but all ages are 18 so the first condition would be met on all of them. I need the multiple conditions on the case to be preserved. :) On 4/9/2010 11:45 PM, Rob Romanek wrote:

Re: [flexcoders] Can someone rewrite this...

2010-04-09 Thread Alex Harui
FWIW, if you are worried about performance, I would test the efficiency of using a map, especially if age is an int and not a Number. Even if it is a Number I might still test out a map with a Math.floor on the age. Var agemap:Object { 0 : 1, 1: 1, 2: 1, 3: 2, 4: 2, 5: 2, 6: 3, 7: 3, 8: 3...