April 24, 2009

the lost actionscript 3.0 weekend

i finally decided to break the print tradition and make an actionscript
training dvd with o'reilly. but it's not your average training video. we
wanted to capture the energy of a programming session with a group of
fun and passionate friends. so james paterson, hoss gifford, and i
locked ourselves away in a cabin by the ocean for a three-day weekend to
shoot an eleven-hour crash course on object-oriented programming. you
can take a look at the results here...

trailers:
>> trailer 1
>> trailer 2 (hoss profile)
>> trailer 3 (james profile)

free course content:
>> course 1 introduction
>> object references and garbage collection
>> inheritance
>> graphics programming with flash player engineer jim corbett
>> flash/flex workflow

the physical dvd will be available very soon, and you can already watch the
entire two-part course online.

>> watch at safari
>> watch at o'reilly

this is a brand-new format for an actionscript training video, so we'd
love to hear what you think. does it work for you as a way to learn? is
it more engaging than the standard "screencast" training style? (we sure
hope so!) post a comment or send me an email (colin@moock.org) to tell me what you think. or you can post a public comment about the video on insideria.

if you are planning on purchasing the video, you should do so through this link:

http://www.oreilly.com/go/law

it gives you a 20-40% discount, depending on what you order. if you're linking to the video, please use that link so everyone can get the discount (o'reilly's main catalog page has the expensive version...)

Posted by moock at 04:04 PM | Comments (16)

April 05, 2009

get number of bytes in a UTF-8 string

Here's a handy little ActionScript function that reports the number of bytes in a UTF-8 encoded string (the default encoding for ActionScript):

public function getNumBytesUTF8 (s:String):Number {
  var byteArray:ByteArray = new ByteArray();
  byteArray.writeUTFBytes(s);
  return byteArray.length;
}
// Usage:
trace(getNumBytesUTF8("automobile"));  // 10
trace(getNumBytesUTF8("車"));          // 3

Note: "number of bytes" is not the same thing as "number of characters". For "number of characters," use the String class's length variable:

trace("車".length); // 1
Posted by moock at 08:39 PM