Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Zoom In/Out Button

Community Beginner ,
Aug 25, 2017 Aug 25, 2017

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!

3.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 28, 2017 Aug 28, 2017

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;

}

}

Translate
Community Expert ,
Aug 25, 2017 Aug 25, 2017

you can use the scaleX and scaleY properties of you main timeline/movieclip (if you're using actionscript).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2017 Aug 28, 2017

Thank you for that insight. Do you know the coding language I would use for this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2017 Aug 28, 2017

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;

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2017 Aug 28, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2017 Aug 28, 2017

you need objects with those instance names.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2017 Aug 28, 2017

I added each of those instance names to its corresponding movie clip but they are not "clickable" when I test the movie :[

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2017 Aug 28, 2017

movieclip are you zooming?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2017 Aug 28, 2017

I got it to work! Thanks so much for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2017 Aug 28, 2017

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2019 Mar 02, 2019

How is the HTML5 Canvas form?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2019 Mar 03, 2019
LATEST

there is no dedicated html5/canvas forum.  currently, this forum is the closest.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 26, 2017 Aug 26, 2017

Are you using Actionscript 3.0 or HTML5 Canvas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2017 Aug 28, 2017

ActionScrip 3.0

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines