all groups > flash actionscript > july 2006 >
You're in the

flash actionscript

group:

What script for Zoom in/ out of image?



What script for Zoom in/ out of image? sdiuhwer
7/26/2006 8:44:17 PM
flash actionscript: 1. I plan to import quite bigger bitmap image and save as a Graphic Symbol

2. Make some Botton Symbols for +(Zoom in, -(Zoom out) and Reset.

3. If I click +(Zoom in) button, image (reduced sized image in smaller window)
got magnified.

----> What scripts do I need for this design? I'm working on Flash8.
Thanks much in advance!!



*** I got this idea from the site of
http://www.metmuseum.org/explore/cezannes_apples/look.html
And click "Let's Look Closely"...
Re: What script for Zoom in/ out of image? butcho
7/26/2006 11:10:28 PM
First of all, dont put your image as a graphic symbol ... use movieClip instead.

Lets say you transform it into a movieClip and give it the instance "image"
and that your zoom button is called zoomBtn and the un-zoom button is called
unZoomBtn:

zoomBtn.onPress = function(){
this.onEnterFrame = zoomIn;
}
unZoomBtn.onPress = function(){
this.onEnterFrame = zoomOut;
}

zoomBtn.onRelease = zoomBtn.onRelease = function(){
delete this.onEnterFrame;
}
unZoomBtn.onRelease = unZoomBtn.onRelease = function(){
delete this.onEnterFrame;
}

function zoomIn(){
image._xscale = image._yscale += 5;
}

function zoomOut(){
image._xscale = image._yscale -= 5;
}
Re: What script for Zoom in/ out of image? sdiuhwer
7/27/2006 12:00:00 AM
bucho, thank you very much for your valuable information. I am not quite good
at actionscripting even though I got excited about this design/ idea. I would
need some time to test but if possible, I would get back to you how it works.
Thanks again.
Re: What script for Zoom in/ out of image? dontworrybehappy
7/30/2006 1:09:22 PM
Thanx butcho,
similar prblm i was also facing... i tried the actionscript u supplied. No
doubt it should have worked but unfortunately for me i got the following errors
in the output window. pl help. I am base level learner and need help. I hope to
get the support.
Thanks in anticipation.



**Error** Scene=Scene 1, layer=pan&zoom, frame=1:Line 1: Statement must appear
within on handler
this.press = function(){

**Error** Scene=Scene 1, layer=pan&zoom, frame=1:Line 4: Statement must appear
within on handler
this.release = function(){

**Error** Scene=Scene 1, layer=pan&zoom, frame=1:Line 7: Statement must appear
within on handler
function zoomIn(){

Total ActionScript Errors: 3 Reported Errors: 3


Re: What script for Zoom in/ out of image? butcho
7/30/2006 4:09:18 PM
Hi dontworrybehappy ,

the lines of code i provide have to be in a frame. It seems like you paste the
code on an object like a movieclip. Try it in a frame but of course the buttons
will need to be accessible at that frame wich mean it has to exist. It will not
work if the buttons only exist 4 frames after the code.
Re: What script for Zoom in/ out of image? dontworrybehappy
7/31/2006 12:00:00 AM
Thanx for the Support, Butcho. Although the errors disappeared once I put the
code in frame, the prblm could not resolved since there was no zoom in/out
effect in the "image". As advised by you, i have put the code & zoombtn,
unzoombtn in the same frame alongwith the "image". Kindly help.
:brokenheart;
AddThis Social Bookmark Button