Be a Supporter!

Moving/Zooming in AS2

  • 381 Views
  • 5 Replies
New Topic Respond to this Topic
white-darkness1
white-darkness1
  • Member since: May. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Moving/Zooming in AS2 2008-11-07 10:03:41 Reply

Yup. Probably the most basic question ever.

I need to be able to move my VCAM with the arrow keys, and zoom in and out using z and x with AS2.


My username sucks.

DarkSkyForever
DarkSkyForever
  • Member since: Nov. 6, 2003
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Moving/Zooming in AS2 2008-11-07 10:14:45 Reply

Easiest way to move a vcam is when a user presses either key, move _root._x and _root._y.

white-darkness1
white-darkness1
  • Member since: May. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Moving/Zooming in AS2 2008-11-07 13:07:32 Reply

At 11/7/08 10:14 AM, DarkSkyForever wrote: Easiest way to move a vcam is when a user presses either key, move _root._x and _root._y.

Mind giving me more info?
I'm AS-retarded. D:

Like, I get what _root._x and _root._y are, they change the coordinates, but I don't know the actual scripts to use.


My username sucks.

uyersuyer
uyersuyer
  • Member since: May. 15, 2002
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Moving/Zooming in AS2 2008-11-07 13:21:30 Reply

onClipEvent(enterFrame){
	if(Key.isDown(Key.UP)){
		_y-=5;
	}
	if(Key.isDown(Key.DOWN)){
		_y+=5;
	}
	if(Key.isDown(Key.RIGHT)){
		_x+=5;
	}
	if(Key.isDown(Key.LEFT)){
		_x-=5;
	}
	if(Key.isDown(90)){
		_xscale--;
		_yscale--;
	}
	if(Key.isDown(88)){
		_xscale++;
		_yscale++;
	}
}

Put that on the vcam.


"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe

BBS Signature
ShizzleCreature
ShizzleCreature
  • Member since: Mar. 20, 2008
  • Offline.
Forum Stats
Member
Level 23
Artist
Response to Moving/Zooming in AS2 2008-11-07 13:27:44 Reply

onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
_y-=5;
}
if(Key.isDown(Key.DOWN)){
_y+=5;
}
if(Key.isDown(Key.RIGHT)){
_x+=5;
}
if(Key.isDown(Key.LEFT)){
_x-=5;
}
if(Key.isDown(90)){ // or any outher key...
this._hight -= 5;
this._width -= 5;
}
if(Key.isDown(88)){ // or any outher key...
this._hight += 5;
this._width += 5;
}
}

something like this..


BBS Signature
white-darkness1
white-darkness1
  • Member since: May. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Moving/Zooming in AS2 2008-11-07 14:02:55 Reply

At 11/7/08 01:21 PM, uyersuyer wrote: Put that on the vcam.

That worked. Thanks a lot. :3


My username sucks.