Copy link to clipboard
Copied
I am an inexperienced Flash/Animate user trying to figure out how to create buttons where a user can zoom in and out. It would be just like a zoom in button and zoom out button on google maps. If anyone knows how to make this happen please help, I would greatly appreciate any insight. A panning function would also be preferable, also like on google maps.
Thank you!
1 Correct answer
var mc_to_zoom:MovieClip = this; // <-or whatever movieclip you want to zoom
zoom_in.addEventListener(MouseEvent.CLICK,zoomF);
zoom_out.addEventListener(MouseEvent.CLICK,zoomF);
function zoomF(e:MouseEvent):void{
if(e.currentTarget.name.indexOf('in')>-1){
mc_to_zoom.scaleX+=.3; // or whatever zoom factor
mc_to_zoom.scaleY+=.3;
} else {
mc_to_zoom.scaleX-=.3;
mc_to_zoom.scaleY-=.3;
}
}
Copy link to clipboard
Copied
you can use the scaleX and scaleY properties of you main timeline/movieclip (if you're using actionscript).
Copy link to clipboard
Copied
Thank you for that insight. Do you know the coding language I would use for this?
Copy link to clipboard
Copied
var mc_to_zoom:MovieClip = this; // <-or whatever movieclip you want to zoom
zoom_in.addEventListener(MouseEvent.CLICK,zoomF);
zoom_out.addEventListener(MouseEvent.CLICK,zoomF);
function zoomF(e:MouseEvent):void{
if(e.currentTarget.name.indexOf('in')>-1){
mc_to_zoom.scaleX+=.3; // or whatever zoom factor
mc_to_zoom.scaleY+=.3;
} else {
mc_to_zoom.scaleX-=.3;
mc_to_zoom.scaleY-=.3;
}
}
Copy link to clipboard
Copied
You are quick. I created a movie clip named "zoom". These error messages came up. Not sure what I am doing wrong. I do appreciate your patience as I am new to coding/animate.
Copy link to clipboard
Copied
you need objects with those instance names.
Copy link to clipboard
Copied
I added each of those instance names to its corresponding movie clip but they are not "clickable" when I test the movie :[
Copy link to clipboard
Copied
movieclip are you zooming?
Copy link to clipboard
Copied
I got it to work! Thanks so much for your help!
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
How is the HTML5 Canvas form?
Copy link to clipboard
Copied
there is no dedicated html5/canvas forum. currently, this forum is the closest.
Copy link to clipboard
Copied
Are you using Actionscript 3.0 or HTML5 Canvas?
Copy link to clipboard
Copied
ActionScrip 3.0

