# Help, I'm trying to add a border

**URL:** https://forum.kirupa.com/t/help-im-trying-to-add-a-border/331459
**Category:** flash
**Created:** [August 5, 2013, 4:07pm UTC](https://forum.kirupa.com/t/help-im-trying-to-add-a-border/331459 "2013-08-05T16:07:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Mark1989](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Mark1989](https://forum.kirupa.com/u/Mark1989)
#### Post date: [August 5, 2013, 4:07pm UTC](https://forum.kirupa.com/t/help-im-trying-to-add-a-border/331459/1 "2013-08-05T16:07:19Z")

</div>

I’m currently trying to add a ‘border’ to my code so the player object doesn’t move off screen when one of the arrow keys is held. I’m pretty new to ActionScript hence my lack of knowledge, so any help given will be greatly appreciated.

I’m unsure if my current coding is needed to help with this so I’ll paste it in case.

import flash.events.Event;

var bg:background = new background  
addChild (bg);

var pp: PlayerPic = new PlayerPic  
addChild (pp);  
pp.x= 125  
pp.y= 550  
pp.height = 40  
pp.width = 50

stage.addEventListener(KeyboardEvent.KEY\_DOWN, arrowMove)

function arrowMove(event:KeyboardEvent):

void

{

if (event.keyCode == Keyboard.LEFT){pp.x = pp.x - 5};

if (event.keyCode == Keyboard.RIGHT){pp.x = pp.x + 5};

if (event.keyCode == Keyboard.UP){pp.y = pp.y - 5};

if (event.keyCode == Keyboard.DOWN){pp.y = pp.y + 5};

};
