2 Replies - 439 Views - Last Post: 03 May 2010 - 10:57 AM

#1 ShaneK  Icon User is offline

  • require_once("brain.php"); //Fatal error :/
  • member icon

Reputation: 240
  • View blog
  • Posts: 1,224
  • Joined: 10-May 09

Zooming in on an image and keeping my place

Posted 29 April 2010 - 07:03 AM

Howdy :)

I'm working on a flash application for viewing a map (related to a game) and in order to "zoom in" on the map, I'm basically stretching the yscale and xscale, but when I do this (as you can imagine), the place I'm viewing on the map changes completely. I figure there has to be a way to avoid this, but how is beyond me...

Any hints?

My code for zooming:
onClipEvent(load){
	lastCheck = 0;
}

onClipEvent(enterFrame){
	if(lastCheck != this.value){
		//Stretch the image to zoom it!
		_root.imageLoader._yscale = 100+this.value;
		_root.imageLoader._xscale = 100+this.value;
		lastCheck = this.value;
	}
}



This is actionscript 2.0.

I figure the x and y of the imageLoader need to be moved, but I don't know how to put it into a formula that'll keep it at its precise point.

You can see my current version in action here:
http://tibialottery....tml?names=false

Yours,
Shane~

This post has been edited by ShaneK: 29 April 2010 - 07:04 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Zooming in on an image and keeping my place

#2 Jason_Fields  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 14
  • Joined: 06-December 09

Re: Zooming in on an image and keeping my place

Posted 01 May 2010 - 08:35 AM

Hey, this may be useful to you. It makes things like zooming and scrolling with a "camera" much easier and simpler. Hope this helps :bigsmile:
Was This Post Helpful? 1
  • +
  • -

#3 ShaneK  Icon User is offline

  • require_once("brain.php"); //Fatal error :/
  • member icon

Reputation: 240
  • View blog
  • Posts: 1,224
  • Joined: 10-May 09

Re: Zooming in on an image and keeping my place

Posted 03 May 2010 - 10:57 AM

That's great, thanks :)

Yours,
Shane~
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1