Log

View Options

Making a World... Map

12/23/10

Google Maps no longer supports this interface configuration...

At work I was given the task of making a world map that will display information in various area based on latitude and longitude. This was quite a challenge as I had no real idea how to translate latitude and longitude into (x, y) points on a map. Lucky with the help of Wikipedia and Gerben Robijn I was able to get my latitude and longitude algorithm working rather accurately. Here is my modified version of Gerben's code, I say modified because it does the same thing but uses more efficient math processing methods.

Snipt.net is dead. Replace link to "http://snipt.net/embed/7c4dddff27428f81a5d2770fb4aba3f5"

Use this map to see how well it works; you can enter points on the map using the menu at the bottom. Note this is a Mercator style world map.

If you played with the zoom you might have noticed (or not) how it maintains the center of your viewing area when you zoom in and out. This was much trickier to pull off that I had anticipated and this time the internet provided no good clues or examples.

Snipt.net is dead. Replace link to "http://snipt.net/embed/c9af775ef5963dca8ac8a7f75adbc757"

Well, I wanted to share that map and those two functions because they were both rather difficult to come across and hopefully this will help some of you out there. If you want to know more about any of the methods I am using here, send me an e-mail or something of that sort. Cheers!


AS3 vs HTML5 Drawing

7/16/10

So Cassie Lightfitz asked me about the new canvas object in HTML5 and at the time I replied that I don't know anything about it. I was aware of some of the new goodies in the future of the web but I am ecstatic with this new canvas object. The canvas object allows for scripted drawing on the fly, just like you can do in Actionscript. Now I naturally the question I had was ,"which one draws faster"?

So I made very similar scrpts using AS3 and HTML5 javascript. Going in I expected flash to be the fastest, as it natively handles vectors, however I became surprised when I finished both and realized that the HTML5 canvas object can be drawn to many, many times faster than AS3 can draw to a sprite. WOW! My attempt to capture just how fast the HTML5 drawing is processed seem to fail but at least the AS3 will return speed results, keep in mind all build time is in milliseconds (1,000 = 1sec).

Ok, what's one big difference? While AS3 draws in vectors the canvas object draws in bitmaps. My theory is that the canvas object actually caches a copy of the drawn star for reproduction while AS3 has to draw it every time. Try producing some stars for yourself. Warning, more than 100,000 might crash the HTML5 version while over 20,000 can crash the Flash version. If you would like copies of the source code to play around with, download the package HERE.

AS3 Drawing:


HTML5 Drawing:

Your browser does not support the canvas element.

How Many?

Center RegPoint?
Enable Rotation?


AS3 to Clipboard to JAVA Communication

2/26/10
Java and Flash icons connected conected by circuts.

After having trouble finding a good example of how to pass information between an ActionScript module and JAVA module I came up with the fallowing solution; Instead of using direct communication (which I was having all kinds of problems with) I simply used the clipboard as a median between the two modules.

    You will need the fallowing:
  1. Something that can compile ActionScript as .exe applications. I'll be using Adobe Flash CS4.
  2. Something that can compile .jar applications. I'll be using NetBeans.
  3. YOUR BRAIN! I had to use mine :)

What we will do:
We are going to build a simple AS3 application that sends data to the clipboard and then runs a .bat file. This .bat file executes a .jar file that grabs clipboard data and tries to make a file out of it.

Ok, let's get started. First thing, lets build our flash interface. I'll be naming the flash module AStoBatch. Make two input text boxes, call one _file and the other _content. Make sure _file is set for single line only, otherwise it sends some funk to the clipboard that will confuse our JAVA app later. Make a MovieClip (this will be our button to send the data) and name it _build. Ok, now lets add our functionality, put this in you main class package:

Snipt.net is dead. Replace link to "http://snipt.net/embed/8083620d18ef18c98238730d6fc0bf40"

Now we need to export our flash module to an .exe, using Flash CS4 all you need to do is check the box in your Publish Settings and then Publish the project. Why do we have to make it an .exe? Well the AVM will not let .swf files execute/run our important fscommand. This can only be done from .exe for security reasons. Sweet! Let us move on to building our simple .bat file. Now the important thing to know here is, any call from an AS3 module to fscommand must reffer to a relative folder called fscommand. So in the same folder you just published your AS3 app to, make a folder called fscommand. Ok, now make a new text file in our fscommand folder and rename the file to RunJar.bat. For those of you unfamiliar with .bat(batch) files, they are terminal files (command prompt) that execute a series of commands. In our RunJar.bat file drop this line.

java -jar "../dist/BuildFromCBD.jar"

Ok, so all we are saying there is: go back to the root folder, go to the dist folder (will be made later) and execute the BuildFromCBD.jar (will be made later). Now is that time to make our .jar file. Open NetBeans (freeware) or what ever your pleasure for JAVA scripting is. Make a new project called BuildFromCBD. And drop this code in your main project file:

Snipt.net is dead. Replace link to "http://snipt.net/embed/69fe6937b5d950359a47f8685043f0ff"

Now compile the .jar and you will have (if using NetBeans) a folder called dist (the one our .bat file points to) and in it will be the BuildFromCBD.jar file. Super sweet! Now I'm not going to explain every piece of code for you, but If you would like, DOWNLOAD THE EXAMPLE PACKAGE and there you will find the proper files all commented for your understanding.


Timer Tools AS3

10/5/09

Lately I have have found myself wanting to store functions to be called at a specific time, at differing intervals, different functions, and all kinds of complicated timer events. I have standardized the way I use timers with a base class called TimeTools that has two different ways it expands on the basic usability of time based events. Any function or series of functions are easily set to fire at any given time.

The functions are fully dynamic, the times are fully dynamic, and you can add any parameters you want. The first method in this class is the delayCommand which stores a function, call time, and parameters to be applied. The second is the timedCommandStack which creates a TimedCommandStack object. A TimedCommandStack executes an array of commands in order in a set interval.

DOWNLOAD EXAMPLE PACKAGE

Flash to PHP Communication

7/29/09

There have been a lot of people asking me about flash to php communication. Mainly the common get/post methods. Here is an example i threw togeather for someone and figured I might as well share it on here. Below is a working example (kind of boaring I know). Feel free to download the zipped up example to see the guts of what is going on here.

PHP to Flash Example Download

Dynamic Timer Event Handling

7/28/09

So, I had a bunch of things that needed to happen in order one after the other, yet there was only one event that fired off all the functions. Well of course I needed to come up with some clever enter frame or timer event. For reasons that are rather trivial, yet valid I have chosen to use a timer event. So then what do I do with the list of functions I want to call? Well lists are just arrays. Ok, what about the parameters for the functions? Ok, let's make our main array multi-dimensional, and the sub-arrays can be a function with parameter values simple right! Have a look for yourself; I'll probably expand this later into a static class you can just throw operations at.

Snipt.net is dead. Replace link to "http://snipt.net/embed/29bb14bd70b9a69182e6878a4d4de638"

UPDATE: I did expand this and make it into a nice little class package. View the post or just download the class package!


AS3 XML class [dXML]

6/1/09

So, since I do a lot of work with XML, I have made a actionscript3 class that makes it easy to load and transverse XML documents. This AS3 class package contains features of both the XMLList and XMLNode objects. While it is a little heavy, the ease of use greatly makes up for that. I call it dXML which is short for "dynamic XML" and "Donovan's XML". I have been using it for the past couple months and have recently decided it's good enough to share! So, please download and use my class, and please send me comments on how to make it better!

DOWNLOAD EXAMPLE PACKAGE!
VIEW CLASS PACKAGE ONLY!


MurderOne Shirt App

5/20/09

So I have finally finished the shirt application for MurderOne Clothing! It turned out pretty well, all and all. There were several last minuet changes making it more interesting, and even though I had to take out some neat tweening effects the overall feel was still intact.

When setting up the pay-pal button, I developed an easy method of passing in multiple extra variables (other than price), using only one button. I will try to get a little example up about my method soon. I have been BUSY, lately look for a lot of updates when the storm calms!
AND!
Check out the T-Shirt App at: MurderOne Clothing

murderoneclothing.com is no longer active


AS3 Preloader Class

3/17/09

Ok, so who is tired of making a preloader for every mid to large size project? Yes it is essential to have something pretty for people to look at while they are waiting for your page or other info to load. But wouldn't it be nice if setting up a preloader was only a couple lines of code? YES!

Soooo, I have made a rather slick preloader class will track anything you tell it to (well so far only The Stage, MovieClips, Loaders, and Sound), just by calling Preloader.trackLoading(your_obj);. All the public functions are static, so they can be access directly by the class name + function name. The super nice part is you can call Preloader.trackLoading(stage); on the your stage and let the preloader do all the work, so anytime you loaded a moive onto your stage the preloader knows and will kick on and do it's thing.

Sound is a little different, I am still trying to capture where in the event phase a sound starts loading, so for now anytime you load a sound via script you would have to tell the preloader to track it manually like, Preloader.trackLoading(ur_sound);.

So, you probably are wondering how simply tracking the data will lead to your own custom pretty loader. There are two stored functions by the preloader class, onLoaded and whileLoading and these are read/write. Well, anyways, if your really interested go ahead and download the class and it's example files.


XML picture displayer

10/10/08

I am happy to announce I have come up with something truly useful for all of you who want to make a simple image slide show but don't want to do all of the heavy coding. My neat little XML based Flash app allows you to crate a slide show with an unlimited amount of images. Every thing is controlled through a nice little XML document that allows you to control the size of your images, positioning, and even offers a nice set of transition effects!
Though I still consider it in it's beta version, it is fully functional. I haven't had many outsiders test it yet, but hey that's what your for! So download it, try it out, and write me back telling me what you think! I need feedback to make this better.

Update!
Ok, one thing I need to add is an image pre-processor that loads all images in the beginning to allow for smother web based use. But as you can see it still operates ok without this feature, anyways, just to let you know, I'll be working on this. But PLEASE send me more ideas to make this better.


Flash Web Site Template

8/22/08
Ok, for those who are new to AS3 or would just like to download a nice template to throw info into, download my example site and you will see plenty of good code commenting along with an easy to use and update interface!

Easy Effects AS3

5/23/08
Easy Effects is a new class I have created for Action Script 3, witch is aimed at handling transition effects for large scale projects. With the Easy Effects class all you do is name an object and the script will animate it for you! It is also very easy to add or customize effects as you see fit (if you know a little AS3).
I make use of some great classes by Jack Doyle, TweenLight and TweenFilterLight you don't have to use these but the standard set of transitions relies on them heavily, for your convenience I have included these files in the package! Hey why not download the Beta version and tell me what you think. Download EasyEffecrs.as

The greensock.com AS3 tween links are no longer active though I'm sure you could still find the libraries on their site.


Symphony City

...old

A project that I have invested many hours into, and many more it seems to come. My roll in the development team is the programmer. While I don't get to do any of the fun design work, my skills as a developer have been getting tested like never before and I am learning a great deal at the same time. The entire game is coded in AS2, with a little tiny splash page using HTML and JavaScript. This on-line on-line educational game is successful at helping children identify with symphonies and classical music. So go ahead and Play Symphony City!.

I was the sole programmer for the site, and made the pass-code system for the login, that enables students to continue sessions, based off of the last level they have completed. This has been my first major web project I have ever tried to tackle

Update!
Phase one of Symphony City is completed! Try it out!

Update!
The game is no longer hosted but you can still play it HERE.