2 Replies - 9639 Views - Last Post: 07 July 2012 - 02:10 PM

#1 meowbits  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 107
  • Joined: 31-January 12

Move scene with arrow keys/mouse

Posted 01 February 2012 - 12:37 PM

Say my scene dimensions are 400x600
but my project is 1000x1200

What are the attributes that I need to edit so that I can move around the project when I press arrow keys?

So far I have,

addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);

function keyPressed(event:KeyboardEvent):void{ 
    if (event.keyCode == Keyboard.UP){

// What goes here?

	}
	if (event.keyCode == Keyboard.DOWN){

	}
	if (event.keyCode == Keyboard.LEFT){
		
	}
	if (event.keyCode == Keyboard.RIGHT){
		
	}
}


Is This A Good Question/Topic? 0
  • +

Replies To: Move scene with arrow keys/mouse

#2 razcobhc  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 11
  • Joined: 07-January 07

Re: Move scene with arrow keys/mouse

Posted 06 February 2012 - 09:57 AM

Hi,
First of all you need your 1000x1200 project inside of a MovieClip and give it an instance name (eg "myObj"). After you do that, in each if block you need to alter the y or x property of myObj accordingly. For up you increase the y of the object by 5 (or how much you want) writing:
 myObj.y+=5;

for down you decrease y, left and right are the same only you use the x property instead of y.

Hope this helps,
Razvan
Was This Post Helpful? 0
  • +
  • -

#3 Liozamu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-June 12

Re: Move scene with arrow keys/mouse

Posted 07 July 2012 - 02:10 PM

If you're wanting to move the actual stage, not the project, then I would just use a vcam, it will save you alot of time and frustration.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1