Morse DeCode: Update

Filed Under (Source Code) by danny on 04-01-2010

Per commenters request, I have added the source code for the Morse DeCode project. Not much else to say about that!

http://visualadvance.com/blog/explorations/morse-decode-with-the-arduino-board-and-flash/

AS3 Video Masks Source Added

Filed Under (Source Code) by danny on 21-10-2009

In the spirit of open source I have added the source files for my first go at creating a video mask in flash. The source can be found at the bottom of my post: Inventing Flash Video Masks (Part 2)

Tip: Keeping Your Place In Code

Filed Under (Soap Box, Source Code, Tools) by danny on 27-08-2009

As my document class files get larger and larger I tend to have a hard time keeping my place. Especially when I need to jump back and forth between a couple spots. So one trick I just naturally started to evolve was to add my own “bookmarks” into my code.

For example if I am working on a function called “showMessage” and I want to jump between the function and where it is being called I might do this:

//#
showMessage();

// blah blah blah other code
// 1000 lines later

//#
private function newMessage():void { }

This way I can just search for the # and keep jumping back and forth. If you were really ambitious you could derive a whole system from symbols

# = links

! = currently working on

% = work on later

Not perfect since a lot of symbols will be used by operators, but it felt like a good LifeHacker type of tip. I supposed you could always search for //! to avoid the operators.

Playing with Dust (In Flash)

Filed Under (Explorations, Source Code) by danny on 09-06-2009

dust

A little while back I made an attempt at making dust in flash, and I would basically say I failed at it (though I didn’t give myself much time). I thought I would try it again. I am fairly happy with my first test. The hardest part is that you run the risk of it looking like snow if its falling too fast, but I kept its speed up more so you can see it easier.

Each particle is looking at the background and adjusting their opacity based on the surface they are over. So if it is in a dark area they tend to fade out, etc. Note: I claim no rights to the image used in my test. It is a random grab from Flickr.

Demo (click and hold your mouse down to see the particles over black)

Source

Code Snippets on Snipplr

Filed Under (Source Code, Tools) by danny on 21-05-2009

snipplr-code201

For those of you who don’t know about it, Snipplr is a handy site for people to share quick code snippets that they think may be handy to others (or just themselves). I created an account and have added a few little Snippets that I tend to reuse often. Mostly AS3 things, but I have included functions for loading xml, reading rss2 and atom feeds, removing all children from a holder, etc.

Take a look. Or don’t. Whateve’s.

Visual Advance on Snipplr

Please note that Snipplr has far more than just ActionScript so it is useful for everyone. They have every language I know of.

Leaf Formations

Filed Under (Explorations, Source Code) by danny on 07-05-2009

leaves_v2.jpg

I have been playing around with some flowing formations lately which I have always avoided because they deal with the dreaded Math. Luckily my friend at Dyleeo helped me out with really understanding how to use sin and cos for smooth movement.

This first version was a test of leaves moving across the screen:
leafFormation_v2

The section version is leaves moving in place (as if the camera was following them):
leafFormation_v3

download source (both versions)

Papervision3D 2.0 Simple Setup

Filed Under (Source Code) by danny on 14-04-2009

papervision_basic

Ok, maybe I am not getting something, but I seem to always have the hardest time setting up a scene in Papervision3D to work the way I want it. I just want a very basic, simple setup to start from most the time. Then from there I can build on it. Please feel free to add your comments below for how wrong I am doing things, or how I am about to promote back practices.

1. (x, y) of the Papervision scene is the center of the stage. (x,y of flash is the top left), so I made a convertPosition function that moves it. I am sure this will totally screw things up once you start moving the camera around, but most the time when I am working on a Papervision project I just need a static camera, and the objects do minimal movement.

2. When you place an object (like a cube) in the scene, “front” is actually facing away from the camera. So I have setup the camera so it is on the other side of the objects (front = front, top = top, etc). This way my brain can comprehend.

3. Materials!!! I know this one is simple, but I always forget how to apply each type of material, so I setup a Material list for my sample cube that uses some of, what I think, are the more common Materials. I also created my own functions for making new materials quickly.

4. Swapping materials. I included one function that swaps a color material on the cube. Real basic, but you can build from there if you want to pass in your own material, etc.

Please note that I based this off of Tyler Egeto’s Basic World Setup Tutorial, so much credit goes to him. I simply built on what he had to address some of my own issues, and I have left a lot of his comments in there because he did such a good job of explaining things in detail.

If you have any of the same problems I do and want a place to start from go ahead and grab my source.

download source

Flash Webcam Motion Tracking – Source Code

Filed Under (Source Code) by danny on 17-12-2008

Just a quick note to let everyone know that I posted the source code requested for the webcam motion tracking that I did.

It is in this post: http://visualadvance.com/blog/?p=127

Flash Webcam Motion Tracking – 1st Attempt

Filed Under (Explorations, Source Code) by danny on 06-11-2008

I decided my next step with the webcam was to attempt some motion tracking. After a couple nights work I managed to get something working fairly well.

The short explanation: I created a grid of squares over the webcam input, and each square is checking to see if there is a bright light under it. If it sees a bright light then it tells a green square to move to that position.

Update 12.17.08:
Here is the source code folks:
download source

This is the code for exactly what you are seeing in the video. I won't be providing a whole lot of support for this version since I have moved past it now in the interest of improving it, and am focusing my energies on those versions (which I may be releasing at a future date).

Many SWFs, One HTML

Filed Under (Explorations, Source Code) by danny on 31-10-2008

I have always had it in the back of my head that it would be so handy to have one HTML file that could display and SWF file that you pass it. Very dynamic, I know. This concept came to necessity when I realized that Wordpress’s upload feature automatically lower cases all your file names which obviously breaks the associations between the html, swf, and and .js embed files you might have (ActiveContent or what not). So i went ahead and built one.

The final result is here: http://visualadvance.com/dynamicdisplay/

Doesn’t look like much, right? Well the good stuff is there, trust me. You just have to pass it a couple parameters like the path of the SWF, and the height and width. So a final URL would look like this:

http://visualadvance.com/dynamicdisplay/index.php?swf=/blog/wp-content/uploads/2008/10/bitmapimage_v6_trippy&height=500&width=500&percent=false

It may look long, but most of that is just the path to the SWF file. Go ahead and play around with changing the height and width. If you want it to be the size of your browser window just change “percent=false” to “percent=true”.