A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11337 Flash Movies | 1 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5828 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.


Random Links | Add your own Flash Related Links
Flash Tutorials 1280 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make a Flash Slide Show Screen Saver
» Simple flash making tutorial for thanksgiving
» Create flash banner for website
» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Interactivity/Other

Categories Pan and Zoom View w/Thumbnail
Author: Galego | Website: http://jason.eastendinteractive.com |

 
Page 8
«prev 1 2 3 4 5 6 7 8

Functions at the root level

These functions are the glue that hold it all together. They are called by the magnifying glass and the slider knob. Somebody really smart could abstract these further than I have...if you do, send me an e-mail attached with the updated version! ;-P

Here's my best practices advice...create an 'actions/functions' layer on any MC you create...especially on the _root layer.

Pre-function code

This code runs when the movie loads before the functions get called...it is still very important
// The base_mag_factor is the correlation of the small picture to the big picture...
_root.base_mag_factor = 5;
// The mag_factor will change as scaling occurs
_root.mag_factor = _root.base_mag_factor;
//Stop so that this doesn't reset willy-nilly on us
stop();
The base_mag_factor is the proportion between your thumbnail and the viewer (viewed) object under the mask. _root.mag_factor starts out baselined, but is variable with the zooming.

The Zoom Function

/*
This function scales the magnifying glass and the bigpicture
It also helps to handle the centering effect on the zoom...
Read the comments on how that happens
*/
function scale_mag (zoom_perc,mag_perc) {
 // getting ready for later...to be able to center
 start_width = _root.mag._width;
 start_height = _root.mag._height;
 //scale it all...
 _root.figure._xscale = (zoom_perc);
 _root.figure._yscale = (zoom_perc);
 _root.mag._xscale = (mag_perc);
 _root.mag._yscale = (mag_perc);
 _root.mag_factor = (zoom_perc/100)*(_root.base_mag_factor);
 _root.zoom_ind = zoom_perc; //updates the percentage viewer
 // The other half keeps scaling in sync and centers the scaling
 // Find out the width and height now
 end_width = _root.mag._width;
 end_height = _root.mag._height;
 // Figure the difference in width and height (x and y)
 x_change = start_width - end_width;
 y_change = start_height - end_height;
 //adjust by half the difference
 _root.mag._x = _root.mag._x + x_change/2;
 _root.mag._y = _root.mag._y + y_change/2;
}
You'll notice the reference to the base_mag_factor (which remains constant)...that is why it has to be defined sepaprately from the mag_factor variable (which changes with the zoom).

The Pan Function

/*
Moves the panel inside the viewing window...
It moves opposite the magnifying glass.
This function is also called when scaling occurs
*/
function move_panel () {
 //trace (_root.mag_factor);
 _root.figure._x = 0 -((_root.mag._x-_root.lilfigure._x)*_root.mag_factor);
 _root.figure._y = 0 -((_root.mag._y-_root.lilfigure._y)*_root.mag_factor);
}
Essentially, the large window object (figure) moves opposite the thumbnail (lilfigure) with the magnification factor figured in. You could also do a simple drag on the object...but the idea here is to keep the inside-outside perspective.

Send me your feedback or questions

«prev 1 2 3 4 5 6 7 8

» Level Advanced

Added: : 2002-08-20
Rating: 7.95 Votes: 21
Hits: 1837
» Author
Galego (aka Jason White) is an Instructional Designer and a Capoeirista from Grupo CapuraGinga.
» Download
Download the files used in this tutorial.
Download (1488 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs