boostworthyisryantaylor

Archive for January, 2007

AS3: Endian Explained

Another one of the many new classes in the AS3 language reference that draws a lot of attention (though mainly because of it's name) is the Endian class. Since a majority of the Flash developers out there lack a computer science background, I thought I'd cover the Endian class briefly in hopes of answering the question 'what does endian mean?'.

The Endian class currently contains two static constants which represent byte order; big-endian and little-endian. Big implies that the byte order starts with the most significant byte first, and little implies the exact opposite.

To help illustrate this better, I threw together a basic example in which the method 'RGBToHex' takes R, G, and B color values and returns the hexidecimal equivalent. The fourth parameter lets you specify the byte order by passing in one of the Endian constants.

ActionScript:
  1. package
  2. {
  3.     import flash.display.MovieClip;
  4.     import flash.utils.Endian;
  5.    
  6.     public class EndianExample extends MovieClip
  7.     {
  8.         public function EndianExample()
  9.         {
  10.             trace(RGBToHex(255, 0, 0, Endian.BIG_ENDIAN));    // Returns '0xff0000'
  11.             trace(RGBToHex(255, 0, 0, Endian.LITTLE_ENDIAN)); // Returns '0xff'
  12.         }
  13.        
  14.         public function RGBToHex(uR:uint, uG:uint, uB:uint, strEndian:String = Endian.BIG_ENDIAN):String
  15.         {
  16.             var uColor:uint;
  17.            
  18.             switch(strEndian)
  19.             {
  20.                 case Endian.BIG_ENDIAN:
  21.                     uColor =  (uR & 255) << 16;
  22.                     uColor += (uG & 255) << 8;
  23.                     uColor += (uB & 255);
  24.                     break;
  25.                    
  26.                 case Endian.LITTLE_ENDIAN:
  27.                     uColor =  (uR & 255);
  28.                     uColor += (uG & 255) << 8;
  29.                     uColor += (uB & 255) << 16;
  30.                     break;
  31.                
  32.                 default:
  33.                     throw new Error("EndianExample :: RGBToHex :: ERROR -> Invalid endian value passed.");
  34.                     break;
  35.             }
  36.            
  37.             return "0x" + uColor.toString(16);
  38.         }
  39.     }
  40. }

In the example, (255, 0, 0) comes out 'FF0000' using big-endian and 'FF' (which is the equivalent of '0000FF') using little-endian. I chose to use colors for this example since the values are something we are all familiar with, however endian constants were defined in AS3 mainly for specifying byte order when communicating with server protocols.

In this case, (255, 0, 0) became (0, 0, 255), and when the color is applied to something, you would have blue instead of red. This is because the hexidecimal colors are read in the big-endian byte order. If the colors were read in the little-endian byte order, (255, 0, 0) would be blue and (0, 0, 255) would be red.

Again, this is something you probably won't be using much in AS3, however it's always good to know everything you can, even if you aren't using it. If you have any questions, post away.

No comments

New Design :: Modulus

I decided to produce one last design before I go into code-mode for the next two months. 'Modulus' is a study of two-dimensional boxes generated by a script in Flash. All the boxes are randomly placed on the stage in different shades and sizes; when done properly, an illusion of three-dimensional stacking and depth occurs. Additional color treatment, texturing, and type were added afterwards in Photoshop.

Modulus

1 comment

New Design :: Binary Love

During the past couple weeks, most of my time has been devoted to a certain Flash website which I cannot openly discuss right now. We finalized most of the major designs back before the holidays, so I've been basically 100% programming this year so far. Though I have a true passion for high-level development, I also love to design; having said that, I was very much in the mood to take a break from the code and do some design work last evening.

My latest piece is titled Binary Love. I wrote a couple of simple scripts in Flash to generate the heart patterns in the background, but other than that it was all done in Photoshop. So what is binary love you ask? A simple statement reveals all: (you & love).

Binary Love

1 comment

FWA 2006 Winners

FWA Site Of The Year:

Philips Bodygroom

FWA People's Choice Award:

Audi R8

::

Congratulations to Tribal DDB New York and Struck Design for winning the SOTY award and argonauten G2 and RTT AG for winning the PCA.

No comments

Sorenson Squish 1.0

Sorenson's latest creation, Squish, is a Java application that can be easily embedded into any website. It allows users to drag-and-drop video files (ASF, DV, MOV, MPEG-1, MPEG-2, MPEG-4, WMV) onto the applet or capture video streams from webcams or camcorders and automatically have them encoded to the FLV format and uploaded to a server.

It is a must-have product for sure.

No comments

Safari Tabs + Flash

This evening I discovered that Safari actually pauses SWF files in tabs that are not active. What I mean by this is that if you have a SWF file running in a tab, and then you click over to another tab, anything that was happening in the SWF file's tab is frozen in place until the tab is active again. To better illustrate this for Safari users, open up a new tab and check out this link:

http://www.boostworthy.com/lc_test/test.html

The script is a simple timer that updates a text field every second. Notice that if you click on to another tab, wait a few seconds, then return to the test, the timer continues onward from whatever value it was on when you left the tab.

Oddly enough, I did some searching for more information on the issue and found next to nothing. The situation in which this problem presented itself is when I was communicating back and forth between two SWF files using a local connection. 'SWF_B' successfully sends a request to 'SWF_A', however the handler for 'SWF_B's request remains paused until it's tab has focus again and vice-versa.

This issue only occurs in Safari; Firefox tabs work just fine.

No comments

A Morphable Model For The Synthesis Of 3D Faces

The video starts off a little slow, but wait until you see the algorithm generate a perfect 3D mesh and texture of Tom Hanks from a single photograph of him in real-time.


Pretty amazing.

1 comment

iPhone Flash Support? Maybe…

*Updated: January 15th, 2007*

Many of us are very curious if Safari on the iPhone will support the Flash Player. Steve Jobs was quoted in saying "Well, you might see that." when asked if Flash support would be present. What is certain is that it will not support Java, but will support PDF documents. Below are some answers to other common questions that you may have.

Service Providers

The iPhone will not work with any service provider other than Cingular. Apple is going to great lengths to ensure this. There will not be an unlocked version of the iPhone. Putting your T-Mobile SIM card in it won't work. As of right now, there will not be a non-Cingular version for the next two years.

Application Support

As you've probably heard, third-party applications will not be supported. Existing Mac OS X programs will not work on the iPhone either. Apple wants to control every aspect of the iPhone themselves for the time being.

iChat Video

One of the missing features from the iPhone that a lot of people are upset about is iChat video support. The camera is on the back of the phone, so even if iChat was one of the included applications, video conferencing would not be possible.

Smudgy Screen?

The screen does get a little smudgy, but it isn't bad at all. You can only see the smudges when the screen is off and a shirt sleeve easily cleans it without smearing it and making it worse.

No comments

Indiana Jones 4 - May 2008

As some of you may have already heard, George Lucas is finally happy with the screenplay for "Indiana Jones 4" and gave it the go-ahead about a week ago. Production is scheduled to begin this June, with a targeted theater date of May 2008. The screenplay was writtern by David Koepp ("War Of The Worlds", "Spider-Man", "Mission: Impossible" and "Jurassic Park"). It is rumored that most, if not all, of the original cast will rejoin the team for what George Lucas says is his last Indiana Jones movie.

Confirmed Cast and Crew:

Director: Steven Spielberg
Executive Producer: George Lucas, Kathleen Kennedy
Producer: Frank Marshall
Story: George Lucas
Screenplay: David Koepp
Original Music: John Williams
Harrison Ford - Professor Henry "Indiana" Jones, Jr.

Rumored Cast

Sean Connery - Professor Henry Jones
John Rhys-Davies - Sallah
Karen Allen - Marion Ravenwood (cameo)
Kate Capshaw - Willie Scott (cameo)
Natalie Portman - Idaho Jones (Indiana Jones’ daughter)
Virginia Madsen - Female Lead
Michelle Yeoh - Female Lead

One of the things that I'm most excited about is that George Lucas says they will be staying true to the original movies by using stuntmen and no computer visual effects. For me, hearing this was a huge relief; I thought for sure they would try to be all modern and it would ruin the magic of the original films. This is great news for sure.

Shooting locations haven't been disclosed, though it is said that it will be shot all over the world, with rumored locations being a desert in Australia and Chinatown in San Francisco. As far as the title and plot goes, there are a million rumors from fans all over the internet, none of which are anything more than that at this time.

They set the benchmark pretty high with "The Last Cursade", so it will certainly be interesting to see if they can achieve another film of that caliber. Oh well, if the movie disappoints, at least we will have our iPhones to cheer us up.

1 comment

How Apple Kept The iPhone Secret

Perhaps equally as impressive as the phone itself is the fact that Apple kept it so secret all this time. Not only did the the project touch nearly every department within Apple, but they also collaborated with Cingular, Google, and Yahoo. So how did they do it? Fortune has the inside scoop on how it all went down; from the employee confidentiality agreements, to the fake prototypes, and disguised software builds. It's a remarkable story indeed.

http://money.cnn.com/2007/01/10/commentary/lewis_fortune_iphone.fortune/index.htm

1 comment

Next Page »