Effective way to Test Dynamic Data from Server and in Flash Authoring Tool

Posted in Flash, testing at 3:10 am by Curtis J. Morley

Say you have a Flash widget that you need to put on the server to receive dynamic data yet you want to test it in Flash with all of your nice trace(); statements etc... The only trouble is that when you post it to the server you always forget to comment out the values that you test with. These are the hard coded values you typed into the file or Class. You don't want to have to remember each time you FTP the file up to the server to comment out those pesky variables that are critical for testing in the Flash authoring tool.

The solution to the problem is quite simple. All you need to do is ask Flash where it lives. You do this by having Flash ask what is its URL using this._url

Here is the code:

if (this._url.substr(0,5) == "file:")
var fillBytes:Number=978;
var totalBytes:Number=2712;

Here is the explanation:

  1. Setup a conditional statement - if()
  2. Because anything run in Flash will be located at a file path, ask if the location(_url) name starts with the characters "file:" - this._url.substr(0,5) == "file:"
  3. If the answer is yes then set your variables - var totalBytes:Number = 2712

A web address will never start with the characters "file:" but rather "http" or the name of a subdomain. Because of this the variables will not yet be defined when the file is on the server and your .swf will be ready to receive anything the server has to throw at it. And yet, you will always be able to test it in the Flash authoring environment.

Happy Flashing


Nikon Aboard the Space station

Posted in Photography at 1:51 am by Curtis J. Morley

How many Nikon Cameras and lenses can you count. The person that guesses correctly gets a big virtual high five. I am amazed at how many Nikon camera and lens' they have in just this one image. And I bet this image was also taken with a Nikon.