i have created a movie clip which are composed of balloon, archer,bow and arrow.
but the main problem is when i clicked the mouse the arrow start to shows up but it does not move vertically, in short it does not shoot upward.
package
{
import flash.events.*;
import flash.display.MovieClip;
import flash.ui.Keyboard;
public class archer extends MovieClip{
public var rightArrow:Boolean = false;
public var leftArrow:Boolean = false;
public var arr:MovieClip = new arrows();
public function archer():void{
this.gotoAndStop('still');
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(MouseEvent.CLICK, onClick);
addEventListener(Event.ENTER_FRAME, Walk);
}
function onClick (event:MouseEvent)
{
addChild(arr);
}
function keyPressed(event:KeyboardEvent)
{
if (event.keyCode==Keyboard.RIGHT)
{
this.gotoAndStop('walking');
rightArrow=true;
}
else if (event.keyCode==Keyboard.LEFT)
{
this.gotoAndStop('walking');
leftArrow=true;
}
}
function keyReleased(event:KeyboardEvent)
{
if (event.keyCode==Keyboard.RIGHT)
{
this.gotoAndStop('still');
rightArrow=false;
}
else if (event.keyCode==Keyboard.LEFT)
{
this.gotoAndStop('still');
leftArrow=false;
}
}
public function Walk(event:Event):void
{
if (rightArrow == true)
{
this.x+=10;
}
if (leftArrow == true)
{
this.x-=10;
}
}
}
}
here is my code, i need your help please, i need to pass it on tuesday.