Cheers.

Jiri

Paul Andrews wrote:
Juan Pablo Califano wrote:
Another option:

function test(value:int):int {
 // just to be safe...
 value = value & 0xff;
 switch(value) {
  case 0x01:  return 0;
  case 0x02:  return 1;
  case 0x04:  return 2;
  case 0x08:  return 3;
  case 0x10:  return 4;
  case 0x20:  return 5;
  case 0x40:  return 6;
  case 0x80:  return 7;
  default:  return -1;
 }
}

Cheers
Juan Pablo Califano
Yes, this is the best way to do it.

Paul
_______________________________________________
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

Reply via email to