Da Unicode

In honor of the theatrical release of The Da Vinci Code (and in response to a question about Unicode values for special characters on a list that shall not be named), I’d just like to throw out a pointer to “The Unicode Character Code Charts By Script”, which has numeric codes and graphic depictions of symbols and characters for Latin characters, the Cyrillic alphabet, a variety of Chinese character sets, Gujarati, Cuneiform, Arabic, Cherokee, and many more!

Color Me Flash!

Over on DIRECT-L the other day, a question (thread: "FLASH: how to pass color string from lingo ") arose about how to pass a color value to a Flash sprite from Lingo. A couple of responses discussed how to pass the value in as a string or as a number, both of which need to be converted to colors within Flash.

In many cases, whatever you do in Flash, you’ll need to work with ActionScript’s Color object to do things like change the color transform of a movie clip. I’ll tell you now how to do that directly from Lingo.

The basic ActionScript procedure for changing the color of a movie clip is this:

  1. Create a Color object associated with a movie clip.
  2. Create a variable containing a duplicate of the transform of the Color object.
  3. Modify the transform variable’s properties.
  4. Set the transform of the movie clip’s Color object.

Assume you’ve got a Flash sprite in channel 1 with a movie clip named test at the root level. To create and associate an ActionScript Color object (co) with the movie clip:

  co = sprite (1).newObject ("Color", sprite (1).test)

To make a copy (tr) of the Color object’s transform:

  tr = co.getTransform ()

The transform of the ActionScript Color object is an object containing eight properties:

ra
red multiplier (0 – 100); mulltiplied by the current red value
rb
red offset; added to the multiplied red value (final value has a minimum of 0 and a maximum of 255)
ga
green multiplier (0 – 100); mulltiplied by the current green value
gb
green offset; added to the multiplied green value (final value has a minimum of 0 and a maximum of 255)
ba
blue multiplier (0 – 100); mulltiplied by the current blue value
bb
blue offset; added to the multiplied blue value (final value has a minimum of 0 and a maximum of 255)
aa
alpha multiplier (0 – 100); mulltiplied by the current alpha value
ab
alpha offset; added to the multiplied alpha value (final value has a minimum of 0 and a maximum of 255)

These properties can be set directly once access to the transform object has been established. For an unmodified movie clip, the color transform will be: {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0}, which is basic black.

Changing the movie clip to red requires two lines: one to modify the copy of the color transform and one to apply the transform to the movie clip’s Color object.

  tr.rb = 255
  co.setTransform (tr)

The result on the red value of the color transform is that its original value of 0 is multiplied by 100, then 255 is added to it, making the result 255.Once the transform has been reapplied to the Color object, the movie clip changes color. Changing the same clip to blue requires you to suppress the red as well as setting the blue (and of course setting the transform):

  tr.rb = 0
  tr.bb = 255
  co.setTransform (tr)

And finally, you cna also change the alpha:

  tr.aa = 0
  tr.ab = 127
  co.setTransform (tr)

An alternative method that skips the whole transform issue is the setRGB method of the Color object. You perform just step 1 above (create a Color object associated with a movie clip), then pass the method a numeric value that represents red * 256 * 256 + green * 256 + blue. Then you’re done. Here’s an example that sets the movie clip to red:

  co.setRGB (16711680)

As John Doe notes in the final post (as of 11 May) on the thread, the Color class has been deprecated in Flash 8 (something I hadn’t noticed), and replaced by the ColorTransform object in the flash.geom package. I haven’t had to figure out how to access that from Lingo yet, though, and since you can only use it in ActionScript if the package has been explicitly included when the SWF was exported, it may pose some problems down the road.

Director Resources Now!

With the subsumption of macromedia.com into the Adobe ‘verse and the end of updates to the 12-year-old Director Web (not to mention the fact that the announcement on Director Online still has Gary reporting from MAX 2005!) it can feel a lot like the edges of the Director fabric are getting a little frayed. Fortunately, there are people like the University of South Wales’ Dean Utian, who know how to stitch things back together. Dean has spent some time recently updating the links on his page of Director resources, making sure that there aren’t any dead links and updating links that have changed.

Bookmark for a rainy day. It may be spring in the Northern Hemisphere, but you know it’s coming…

Battle of the Script



Still thinking that Flash’s Actionscript language is piffle? I’ve been trying to convince Director developers for five years that they can’t ignore the ever-increasing capabilities of AS (while simultaneously promulgating Director to Flash users). Even though many people have recognized the utility of Flash, snarky comments about Actionscript’s capabilities abound. I don’t really understand it myself.

As an example of the type of thing that’s possible in Flash these days, I point you to the 2006 Battle of the Script at ActionScript.com. The contest (with a grand prize of $500 and a number of books) is based around the use of an open source library for text animation called TextScript (developed by Satori Canton). Come up with the coolest effect and win one of the prizes.

My challenge — with no prize attached — is to try doing some of the demonstrated effects in Lingo. In part, that’s made difficult by Director’s architecture, but I think that it’s obvious that ActionScript’s capabilities are definitely in the ring.

Joel on Shockwave

I’ve been working on developing a functional spec for an application over the past couple of weeks. It’s something I’ve done for most of my larger projects because it helps me organize and think through the design, but the one I’m doing now has to be interpreted by other people. So I’ve been doing a little reading on the subject to make sure I knew what other people might expect and ran across the site Joel on Software, which has several years worth of interesting, highly readable articles on software development strategies.

Naturally, he has an article — actually, a series of articles — on why functional specs are useful, what should go into them, and who should be responsible for them. I don’t agree with everything he says, but there is a fair amount of decent information there.

One thing that did catch my eye, though, appears in the example spec he links to from the articles. It’s a humorous example, written nearly six years ago, for a web site that tell users what the time is. Here’s his description of the site’s splash screen:

An annoying, gratuitous Shockwave animation that plays stupid music and drives everyone crazy. Splash Screen will be commissioned by a high-paid graphics animation boutique in a loft in Soho from people who bring their dogs to work, wear found objects safety-pinned to their ears, and go to Starbucks four times before lunch.

After the animation has played for about 10 seconds, a link that says “SKIP THIS” will fade into view in the bottom right corner. To avoid people seeing this and clicking on it, SKIP THIS will be so far down and to the right that most people won’t see it. It should be at least 800 pixels from the left border of the animation and 600 pixels from the top.

Clicking on SKIP THIS goes to Home Page. When the animation is complete, it will redirect the browser to Home Page automatically.

Open Issue
If Marketing allows, we should deposit a cookie on the user’s computer if they click SKIP THIS which will cause the animation to always be skipped in the future. Frequent visitors should not have to see the animation more than once. I talked to Jim in Marketing about this and he’s going to take point in convening a committee of Sales, Marketing, and PR to discuss.

Does that “annoying, gratuitous” description of an intro animation sound familiar? Does it sound like Shockwave? Or is it possible that even someone who worked in the software industry at a fairly high level was confused enough by the Macromedia/Shockwave/shockwave.com marketing strategy to call a Flash animation “Shockwave”. Pretty funny, eh?

GDC2006 Post X: Round-Up

Here’s the round-up of my posts from the last couple of days on the Game Developers Conference 2006: