Flash Stuff  

This is a collection of bits and pieces posted either for my students, or in answer to questions posted on FlashMove. Some are very simple, some are quite tricky, some contain comments in the source files, others don't. I hope you find something interesting or useful here... Click the titles to see the examples.

Starfield in 3D
This was done for our local user group. It shows how to generate a moving starfield in 3D using only script. Because it only uses script, there's no source to download, just open the text files and copy/paste into the script window for the first frame of an empty movie!

Sliding Menu Bar
This is one of those things everyone wants to know how to do - basic Flash but actually trickier than you think if you're an ActionScript newbie...
My version contains comments illustrating what you need to do to re-use in your own movies
Get the FLA

Remember the Spirograph? The patterns created by the rotation of a wheel within a wheel...
This is a maths version using the drawing extensions in Flash MX and because we don't need to fiddle around with cogs and pens we can have wheels within wheels within wheels...
Get the FLA

Maze Generator
I set a maze game exercise for my students and it set me thinking...
This is an interesting problem that needs lots of array manipulation to solve...

Straw words
A combination of hit-testing and drawing commands creates straw letters.

A load of balls that bounce and obey gravity and explode away from the mouse when you click it.
Get the FLA

Flying Saucer
A flying saucer that moves according to cursor key presses... look inside the symbol definition for the script.
Get the FLA

Tic-Tac-Toe (Noughts & Crosses)
This is a Flash 5 version of the popular game. It was tougher to do than I expected it to be.
Get the FLA
Read an explanation...

A sequence of demonstrations with a number of objects with programmed behaviours. Ihaven't put up the source for these... mainly because its what I'd call evolutionary code... meaning it started out as a fairly simple thing and evolved into something horrible... at least from the point of view of trying to comment or explain it!

Flash MX 3D cube
This was my first downloadable MX file. This uses the drawing commands to create a 3D cube. Sliders allow you to change the rotation and the perspective projection.
Get the FLA.
...and if you find this interesting, -here's a challenge for you...

Lip Sync
We held a user group meeting on the theme of sound in Flash & I used this file to show how to tackle lip sync. Its an animation technique - rather than a Flash technique but its still interesting so I thought I'd post it. The Flash file is 1MB so be prepared for a wait if you want to download it.
Download a simplified FLA

Rollover Scaling
This example shows how to construct a set of pictures that rescale themselves according to which image the mouse covers.
Read an explanation of this example.
Get the source file.

Colliding Balls
A lot of balls bouncing around and colliding with each other - uses circular hit-test code - not Flash's bounding box test.
Get the source file.

Panorama Example
The example shows a panorama stitched together from seven photos taken on top of Wave Rock in Western Australia. The movie allows you to zoom and pan the image pretty much like the map example below - but this one is much easier to modify - you can easily replace my image with your own, use the same code for different movie sizes etc...
Get the source file.

Sound Mixer
This is something I created for the local Singapore user group meeting. It's a sound mixer allowing you to change the level & stereo position of 8 different synchronised sounds.
...you need good stereo sound to appreciate this example. I'm not being mean in not providing the source for this one... it's just that the FLA with the wav sounds inside is a whopping 33MB!

Fractal Pattern
This example creates a pattern by recursively attaching a movie clip inside itself.
Get the source file.

This is an example of the old programmers favourite, the game of Life. I did it to explore 2D arrays in programming.
Get the source file.

Memory Game
The old favourite card matching game. No source for this one- sorry.


using an ASP mailer to send email from Flash without invoking the user's mail client

Color Transform
simple example of how the color transform is used in ActionScript.
Get the source file.

Simple example of how to make a timer count whole seconds using the getTimer() function
Get the source file.

Swap Depths
A simple example showing movie clips which come to the front when you drag them so that the clip being dragged is always on top.
Get the source file.

Courtship Dance
One of my more popular posts on FlashMove. Random swirling trails based on polar coordinates.
Get the source file.

Someone posted a question about how to make the mouse repel movie clips. This was my second solution (the sheepdog example was the first).
Get the source file.

Horizontal Scroll
Scrolling and scaling controlled by the mouse. This was posted in response to a question about how to make a movie clip seem as if it scrolls forever. It scrolls at variable speed according to the horizontal position of the mouse and scales according to the vertical position.
Get the source file.

Jelly Button
a button that wobbles when you click it
Get the source file.

Map Zooming and Scrolling
Zooming and scrolling a map to specific locations.
Get the source file.

Pointer Hell
moving & turning an arrow movie clip toward the mouse
Get the source file.

Flash 4 tutorial on how to read a list of words into an array & randomise them. The new Array commands in Flash 5 make a lot of this redundant so I wouldn't bother unless you're still using 4.

Someone posted a question about how to make the mouse repel movie clips. This was my first solution (the frogspawn example was the second).
Get the source file.

slinky spring effect trailing the mouse.
Get the source file.

The arrow rotates toward the mouse with a delay
Get the source file.

spring return
drag the dots & let go to see them spring back
Get the source file.

bubbles rising from the bottom
Get the source file.

Using the date object to make analog or digital clocks. These are self contained movieclips so if you just want to display the users computer time on your flash application, download it and open it as a library. Open the file in flash to modify or investigate.
Get the source file.

drag mask
one way to create and use a draggable mask
(Similar to the magnifying glass example but not as well written.) Note: this was written in Flash 5 - we weren't able to control mask layers with script until Flash MX... now that you can, this exercise is redundant.
Get the source file.

drag position
continuously reporting the position of a dragged object. A very simple example written in response to a question.
Get the source file.

Simple example showing how to use the droptarget property.
Get the source file.

old method (Flash 4) of making an MC glide smoothly using scripting. In Flash 5 I would do this using onClip events.

how to make a whack-a-mole type game (9 page tutorial).

3D Object
importing a sequence of images to create a 3D rotation effect
Get the source file. (zipped)

Pseudo 3D
How to make text look 3D using only Flash. There is no source file because the animation illustrates a drawing technique, not scripting. Watch the movie to study the steps.

Continue Drag
Drag a movie clip and let go... it keeps moving & bounces of the sides of the window
Get the source file.

eyes that follow the mouse - unfortunately I lost the FLA but it may give you some ideas.

How to create a rubber band effect.
Get the source file.

Magnifying Glass
Using scripting to simulate a draggable mask which creates a magnifying glass effect.
Note: this was written in Flash 5 - we weren't able to control mask layers with script until Flash MX... now that you can, this exercise is redundant.

Get the source file.

Very simple exercise reflecting the position of a movie clip
Get the source file.

string pic
repeats, scales and rotates a series of movie clips between two points.
Get the source file.