Here's a fun little Flash technique for creating a magnifying glass effect. With some minor modification, it can also be used to create an x-ray effect or CSI style black light effect, etc.
Important: make sure that the registration for this clip is centered (not top-left). Give the instance of the movie clip the instance name glass.
onClipEvent (enterFrame) {
_root.glass._x = (_root._xmouse);
_root.glass._y = (_root._ymouse);
Mouse.hide();
}
This code causes the movie clip (the circle) to follow the cursor around the stage. Since the clip is a mask, you see the a small portion of the larger image, revealed through the mask "window" as you drag across it. However, you can't see the entirety of the larger image yet because part of it extends beyond the edge of the stage. What we need to do next is add a script that will move the larger image when the mask moves, but in the opposite direction:
onClipEvent (enterFrame) {
_root.bigImage._x = (_root._xmouse * -1);
_root.bigImage._y = (_root._ymouse * -1);
}
This code moves the big image in an inverse relation to the cursor. However, you must make an adjustment to the code depending on the ratio of your large image to small image. If your smaller image is half as big as your larger image, the above code will work fine. If your smaller image is one-third the size of the larger one, change the –1 in the code to –2. If your smaller image is one-quarter, use –3. If it is two-thirds, use –.5. There is a simple formula to calculate the proper factor based on the ratio, but I've forgotten it; I'll figure it out later.
4 pts |
Portfolio quality design. |
3 pts |
Good looking; above average work. |
2 pts |
It works, but it's nothing fancy. |
1 pts |
Something's not working right. |
0 pts |
Poor showing; mostly incomplete or full of errors. |