type = 'application/x-shockwave-flash'
data = 'http://sitepointstatic.com/flash/macbutton.swf'
width = '400'
height = '400'
bgcolor = 'black'
>

When I first saw Mac OS 9, I saw buttons at the bottom of the desktop that scaled according to your mouse position, and decided to do the same thing in Flash.

Download the sample files here. Let’s start!

1. Create a movie clip of your choice.

Here, I’ve used buttons from the Fflash buttons library and converted them to a movie clip. You can add as many movieclips as you like.

2. For this effect to work, there is only one thing you have to do. Right click the movieclip, go to the action, insert:

onClipEvent (enterFrame)  
{
mouse = _xmouse;
if (mouse<0)
{
mouse = -1*mouse;
}
scale = 200-mouse;
if (scale<100)  
{
scale = 100;
}
if (scale>200)  
{
scale = 200;
}
setProperty ("", _xscale, scale);
setProperty ("", _yscale, scale);
}

Place this action in every movieclip. Then, test the movie.

Georgina Laidlaw
Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

No Reader comments

Related books & courses
Available now on SitePoint Premium

Preview for $1