Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Zoom Slider

Status
Not open for further replies.

blasterstudios

Technical User
Dec 30, 2004
128
US
I need some help creating a slider that controls the size of my movie clip. What i've got is a movie clip that can be moved around the screen. I found the code to do this here:

I also have a slider that goes up and down. What I want is for the slider to control the size of my draggable movie clip. I'm not sure how to go about doing this. Here's the page i'm using it on:

All I need help with is setting up a function to make my ball movie clip get bigger and smaller as the mouse moves up and down the slider, but still allowing for the user to move it around the screen. i've got a reset button in case it gets off screen.

These are the functions for the slider:
Code:
zoomslider.onpress=function(){
	zoomslider.startDrag(false,11.1,23.3,11.1,108.3);
	d=1;
};

zoomslider.onrelease=function(){
	stopDrag();
	d=0;
};

the zoomslider sits inside a movie clip on the main timeline. My ball movie clip is also on the main timeline. its instance name is "dragit". If anyone can help, i would greatly appreciate it!
 
by the way, this is the function i tried to use to resize the object, but it doesn't work and causes my ball movie clip to not be dragable.
Code:
onmousemove=function(){
	if ((_xmouse>108.3) || (_xmouse<23.3)){
		stopDrag();d=0;
	} else {
	if (d==1){
		disp=zoomslider._y * 10;
		_root.dragit._width=disp;
		_root.dragit._height=disp;
		}
	}
};
 
Another option I may go with is what you see on the site now:

The 4 zoom options. But i'm having one issue with this. As I mentioned before a movie clip with a ball in it. Well, that ball has been replaced by our family tree.

anyway, the problem is when I zoom, it zooms from the top left. What I would like is for it to zoom in based on the center of the flash movie. How can I do this? All i'm doing for the zoom is:
Code:
on(release){
	_root.dragit._width = int(_root.mywidth) * 2;
	_root.dragit._height = int(_root.myheight) * 2;
}
I do this for each one.
 
is that for all of them, or just that example i showed because i'm multiplying by 2?

also, when you open that page, the movie clip isn't set at 0,0. the family tree has a white background that is larger than the actual tree to allow for dragging on the sides of it. so when you open the movie, the Top Left corner of the mc starts on: -207,-152. The center of it is at: 326.9,237.8

I guess when you do _width and _height, it automatically does it from the top left corner.

Does what you said still apply?
 
>is that for all of them, or just that example i showed because i'm multiplying by 2?

Yep. If you are doing x9 zoom (x3 height and width), then you need to move it by –width and –height. If you draw it on a piece of paper it may help to visualize what you have to do.

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top