XOR equivalent in flash

  • yuriythebest
  • Banned
  • Banned
  • User avatar
  • Posts: 143
  • Loc: Ukraine

Post 3+ Months Ago

what's the operator in actionscript that most other prog. langs. call xor - either one or the other, but not both or neither. thanks.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Flash has a bitwise xor operator which is the carret ^ , which would be used like so,
Code: [ Select ]
trace((0<1)^(1<2)); //returns 0, both were true
trace((0>1)^(1>2)); //returns 0, both were false
trace((0<1)^(2<1)); //returns 1, first was true but second was false
trace((0>1)^(2>1)); //returns 1, first was false but second was true
  1. trace((0<1)^(1<2)); //returns 0, both were true
  2. trace((0>1)^(1>2)); //returns 0, both were false
  3. trace((0<1)^(2<1)); //returns 1, first was true but second was false
  4. trace((0>1)^(2>1)); //returns 1, first was false but second was true
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

You have to love the example in the reference panel of Flash, :lol:
Code: [ Select ]
// 15 decimal = 1111 binary
// 9 decimal = 1001 binary
x = 15 ^ 9
trace(x)
// 1111 ^ 1001 = 0110
// returns 6 decimal( = 0110 binary)
  1. // 15 decimal = 1111 binary
  2. // 9 decimal = 1001 binary
  3. x = 15 ^ 9
  4. trace(x)
  5. // 1111 ^ 1001 = 0110
  6. // returns 6 decimal( = 0110 binary)
  • yuriythebest
  • Banned
  • Banned
  • User avatar
  • Posts: 143
  • Loc: Ukraine

Post 3+ Months Ago

thanks!

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.