View Full Version : A simple zoom from Senoculars advance zoom-and-pan script
johnnyboy
01-11-2006, 11:14 AM
Hi guys,
I've tried to modify the zoom script on senoculars website to a total simple zoom function.
http://www.senocular.com/flash/source.php?id=0.76
I want to use the slider, but without the pan-function and zooming in on different places on the main window.
Only thing I need is the slider to zoom in on the center of my main movieclip. I need to have a max. and min. _xscale and _yscale...
Can anybody help me out here... It should be pretty simple, but never used the slider thingy before, so I'm all lost here...
thanks
johnnyboy
01-11-2006, 05:19 PM
I have cut most of senoculars script, and I think I have what I need to make the smooth zoom, but it don't work.
I have this in my AS layer frame 1.:
function ScaleMapTo(percent){
CONTAINER_mc._xscale = CONTAINER_mc._yscale = percent+50; // apply scales to map
}
function SliderChange(newSliderValue){
ScaleMapTo(newSliderValue); // scale map based on new value of slider
return newSliderValue; // return value so its applied to the actual value variable
}
slider.watch("value", SliderChange);
And here's the modyfied script placed on frame 1 in the slider mc:
// variables
width = 100; // height to drag the slider
value = 0; // default this value variable at 0
grabber.onPress = function(){
// when you press the grabber movieclip, start the drag
this.onMouseMove = function(){
this._x = this._parent._xmouse; // move the _y of grabber with the mouse
this.Slide(); // call slide function to restrict sliding and set value
}
}
grabber.onRelease = grabber.onReleaseOutside = function(){
delete this.onMouseMove; // delete mouse move method when releasing grabber
}
/* Slide: restricts movement of the grabber movieclip
and sets the value of the value variable based on its _y
position in relation to the set height in the component properties
*/
grabber.Slide = function(){
if (this._x < 0) this._x = 0; // keep _y 0 or above
else if (this._x > width) this._x = width; // keep _y within height
value = this._x/width; // derive value of value
}
/* setValue: allows you to set the value of this slider
Setting the value will update the slider position and value
*/
setValue = function(percent){
grabber._x = -percent*width; // set _y to position based on height
grabber.Slide(); // use Slide to restrict position and set value
}
Can somebody help me out here... nothing happends to my CONTAINER_mc at any point, am I missing some important to make it grab the MC or...?
morkus_2
09-06-2009, 09:55 AM
Ok i wanna do this panning also to my map but iam using as3 and i really need to add this code to my .as file can any one help me to do that please thank you here is my map http://www.hurghada.com/map.aspx and i just wanna know how to put this code in my as3 please i already made the zoom now i need to make the pan so please let me know thank you
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.