Re: [Flashcoders] Bitwise selection

2009-04-03 Thread Jiri
So each element in a ByteArray can hold 8 bits. What about the readInt() method of the ByteArray, does an integer then span over 4 elements of the bytearray. And if I start at position 0 and then call the readInt(), is the position after that then 4? Jiri Kerry Thompson wrote: Jiri wrote:

RE: [Flashcoders] Bitwise selection

2009-04-03 Thread Kerry Thompson
Jiri wrote: So each element in a ByteArray can hold 8 bits. What about the readInt() method of the ByteArray, does an integer then span over 4 elements of the bytearray. And if I start at position 0 and then call the readInt(), is the position after that then 4? Essentially, yes. A ByteArray

Re: [Flashcoders] Bitwise selection

2009-04-03 Thread Mark Winterhalder
On Fri, Apr 3, 2009 at 8:38 AM, Jiri jiriheitla...@googlemail.com wrote: So each element in a ByteArray can hold 8 bits. What about the readInt() method of the ByteArray, does an integer then span over 4 elements of the bytearray. And if I start at position 0 and then call the readInt(), is

Re: [Flashcoders] Bitwise selection

2009-04-02 Thread Hans Wichman
Hi, isn't the absence of break statements messing things up? greetz JC On Thu, Apr 2, 2009 at 12:08 PM, Jiri jiriheitla...@googlemail.com wrote: I am new to bitwise operators, so I am trying to learn it. I have the following code and it works half. I am using a switch case to get the

Re: [Flashcoders] Bitwise selection

2009-04-02 Thread Jiri
Thanks Hans, I am aware of that, so if-else would be the only way to go I guess. Jiri Hans Wichman wrote: Hi, isn't the absence of break statements messing things up? greetz JC On Thu, Apr 2, 2009 at 12:08 PM, Jiri jiriheitla...@googlemail.com wrote: I am new to bitwise operators, so I

Re: [Flashcoders] Bitwise selection

2009-04-02 Thread jonathan howe
Jiri, I think Hans's advice will get you what you want. case RESTRICTION1 : tRestrict +=\u0020-\u007E; trace('all'); break; case RESTRICTION2:

Re: [Flashcoders] Bitwise selection

2009-04-02 Thread Mark Winterhalder
Jiri, if() isn't too bad, especially since you will possibly want to permit multiple restrictions (like numbers /and/ letters, or Latin letters plus umlauts). If you use if() and combine that with appending to the restriction instead of setting it (+= instead of =), you gain flexibility. That

Re: [Flashcoders] Bitwise selection

2009-04-02 Thread Jiri
Thanks for the helpfull feedback Mark Winterhalder wrote: Jiri, if() isn't too bad, especially since you will possibly want to permit multiple restrictions (like numbers /and/ letters, or Latin letters plus umlauts). If you use if() and combine that with appending to the restriction instead of

RE: [Flashcoders] Bitwise selection

2009-04-02 Thread Kerry Thompson
Jiri has gotten some good answers. I got to work late today after working until 11:30 last night meeting my 5:00 deadline :-P I did occur to me that a fair number of us may not completely grok bitwise stuff. That's computer science stuff, and a lot of us got here by other routes-I see a lot of

Re: [Flashcoders] Bitwise selection

2009-04-02 Thread Jiri
Nice, that you took the time to write that post. It is much appreciated. Jiri Kerry Thompson wrote: Jiri has gotten some good answers. I got to work late today after working until 11:30 last night meeting my 5:00 deadline :-P I did occur to me that a fair number of us may not completely

RE: [Flashcoders] Bitwise selection

2009-04-02 Thread Kerry Thompson
Jiri wrote: Nice, that you took the time to write that post. It is much appreciated. Thanks, Jiri. One other thing worth mentioning is that an integer is actually 4 bytes, so you have 32 bits. I kept my example to one byte for simplicity. If you want to do operations on a single byte, you can