Get Adobe Flash player

Posts Tagged ‘flash’

AS3 DragObject – Dynamic Animation via Destination

Thursday, March 6th, 2008

I’ve been using this DragObject class for a while now. It was just a quick little MovieClip extension I threw together to give any MovieClip I had a destination x and y to automatically animate to. Simply explained, when the destination x and y are changed, the onEnterFrame function makes sure the clip animates to it. Since putting it together, I’ve been very fond of this sort of tweening concept. It allows for dynamic changing of properties without needing to worry about mid-animation changes; with only 1 property determining the destination value, your MovieClip will never get confused or lost as to which way it should be going.

One thing to note is that on the timeline I have set up a globalMouseUp function. This is necessary for implementation of the DragObject if your cursor is able to leave the object when dragging it.

Also added in some fun proximity checking. Source and Enjoy.

-Andrew

Welcome to my Laboratory

Monday, February 11th, 2008

labs.andrewwalpole.com is up, and although it is nothing more than a few links and some blurry tree thing, it is where I will start to post some of my experiments and projects that don’t quite fit into my portfolio. I’ll give you a brief overview of what is up there right now.


First up is the project that spawned my idea to build my MixBoard AIR application. This is a much simpler version of what the application is today, it loads in a handful of looping mp3 files and allows you to mix them together on the board, pretty simple, instructions are even included.


Second is Commet, a school project I created using AS3, PHP and MySQL. It is my take on a flash-based social network. The entire premise is that you can access all portions of the service by either dragging objects or clicking them. Someday when I have a nice multitouch event system built I’ll spend a few minutes to hook it up to my multitouch screen.


Third is a quick little screensaver idea, I guess I was going for cells under a microscope. It makes extensive use of the Math.random() function and all the graphics are generated through the AS3 drawing API. I would really like to see Adobe pop out a nice little background-running AIR application to run flash-based screensavers – because I’m too busy right now to do it myself.


Finally, I present to you my award-winning widget, the ThumbPlay Ringtone Radio. I built this widget for the ThumbPlay Widget contest put on during FlashForward 2007. Even though my company was planning on forking over the conference money, they were pretty happy when they heard I had won all of my expenses paid, I was pretty stoked as well. If you are wondering why it’s not making any noise, that’s because it seems that ThumbPlay has removed their crossdomain.xml file. Maybe one day I will bug them to stick a new one up there. Total development time from start to finish: 6 hours (4 in Photoshop).


So that is my new laboratory. I’ll be sure to post my updates here and if there is any source code you want to peruse, just ask nicely.


-Andrew

A RangeList class in AS3 – An example of extending functionality

Thursday, January 17th, 2008

In a recent project that came across my path, I found myself needing to write a custom data structure. When I began constructing the structure in my head, I thought back to my C++ days and templated classes. Templating the functionality of a class allows you to use the class in many situations without extending the class to deal specifically with the data type you are working with (Numbers, Strings, MovieClips, etc). In AS3, there isn’t exactly a construct built in to specifically declare a class as a template. However, the perfect container is available to us to simulate this functionality; the Array.

By creating a class that acts upon objects in an Array, the data type of the objects contained in the array is irrelevant. Note that if you are planning to modify specific properties of the data type contained in the array, you will have to extend the class. This is where the templating in AS3 begins to break down, but that’s ok, there is still a lot we can do.

With the RangeList, I have created a data type similar to a circular list, however it defines a range of items that allows you to traverse a subset of the entire array and also allows you to independently modify the subset that you are currently working with. This set of functionality is great if you want to create any sort of dynamically sized menu.

And here is the source and the fla

-Andrew