# XOR equivalent in flash

• Banned
• Posts: 143
• Loc: Ukraine

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.
• Genius
• Posts: 13511
• Loc: Florida

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
• Genius
• Posts: 13511
• Loc: Florida

3+ Months Ago

You have to love the example in the reference panel of Flash,
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)
• Banned
• Posts: 143
• Loc: Ukraine

3+ Months Ago

thanks!

## Post Information

• Total Posts in this topic: 4 posts
• Users browsing this forum: No registered users and 10 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