Flash Script – Zoom Lens

Share this article

1. Open a new movie with a width of 400 and a height of 400, and a frame rate of 40/s.

2. Import into Flash a picture of your choice that has the same length and width as the frame.

3. Convert the picture to a movieclip.

4. Name the current layer Image 80%.

5. Align the picture movieclip exactly in the center of the stage.

6. Using the transforming tool scale the size to 80%.

1064_bird

7. Create a New layer name it "lens".

8. In the new layer create a circle.

9. Convert the circle to a movieclip give it an instance name "magnify".

1064_tool1

10. Go to the timeline of "magnify".

1064_tool2

11. Create a new layer and drag the picture movie on to the timeline. Align it the center of the stage.

12. Drag the new layer below the old layer, as shown below.

1064_tool3

13. Make the top layer a mask.

14. Next, go to the main time line, create three key frames as shown below.

1064_tool4

15. In the first key frame, insert the action:

startDrag ("/magnify", true); 

16. In the second key frame, use the action:

xx = getProperty("/magnify", _x); 
yy = getProperty("/magnify", _y);
setProperty ("/magnify/bigpic", _x, 200-xx);
setProperty ("/magnify/bigpic", _y, 200-yy);

17. In the third key frame, insert the action:

gotoAndPlay (1); 

18. Play the movie! If you have followed these steps, you will get the result shown above!

19. By giving the action Mouse.hide() you can hide the mouse cursor.

Georgina LaidlawGeorgina Laidlaw
View Author

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.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week