hi im a newbiew in as3 programming can u help me find a solution with my problem?>>> i have 6 frames.... the 1st frame has an action w/c calls/play the remaining frame depending w/c button they click let say button1 and so on.... here's my action for frame4 ------------------------------------------------------------------------------------------->> here's my problem ... 1. ) the keyListener won't work not until i click on the interface. 2. ) can't add a child with sprite in frame 4...it doesn't show and when i click back button error occurs... error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at BlockBox12_fla::MainTimeline/frame1() at flash.display::MovieClip/gotoAndPlay() at BlockBox12_fla::MainTimeline/backnClick() ----------------------------------------------------------------------------------------------//here's my code stop(); import flash.events.KeyboardEvent; import flash.display.Sprite; //keycodes var left:uint = 37; var up:uint = 38; var right:uint = 39; var down:uint = 40; var tempX:int = 1335; var tempY:int = 2370; //-----------------------------------------------------------------------i believe this have something to do with #2 error var clockFace:Sprite = new Sprite(); clockFace.gra phics.drawCircle(200, 200, 50); clockFace.graphics.beginFill(0x0190ff); addChild(clockFace); //----------------------------------------------------------------------- back_btn.addEventListener(MouseEvent.CLICK, backnClick); stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownListener); function backnClick(event:MouseEvent):void { //trace("button clicked!"); gotoAndPlay("main"); } function keyDownListener(e:KeyboardEvent) {
if (e.keyCode==left){
if( _student.x >= 350){ _student.x-=5; trace("student.x is >= 350"); } else if( tempX >=330 ){ bg_scroll.x+=5; } else if(_student.x <= 0){ _student.x = _student.x; tempX+=5; } else _student.x-=5; tempX-=5; } if (e.keyCode==up){ if( _student.y >= 250){
_student.y-=5; } else if( tempY >= 355 ){ bg_scroll.y+=5; } else if(_student.y <= 0){ _student.y = _student.y; tempY+=5; } else _student.y-=5; tempY-=5; } if (e.keyCode==right){ if( _student.x < 350){
_student.x+=5; } else if( tempX+500 <= bg_scroll.width){ bg_scroll.x-=5; } else if(_student.x + _student.width >= 800){ _student.x = _student.x; tempX-=5; } else _student.x+=5; tempX+=5; } if (e.keyCode==down){ if( _student.y < 250){
_student.y+=5; } else if( tempY + 265<= bg_scroll.height){ bg_scroll.y-=5; } else if(_student.y + _student.height >= 595){ _student.y = _student.y; tempY-=5; } else _student.y+=5; tempY+=5; } }