Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error #1009: Cannot access a property or method of a null object reference.

Guest
May 07, 2012 May 07, 2012

i have strange error.

i have one scene with complicated game whick contains only one frame which works ok.

i created onother welcome scene which contains only btn containing "nextscene". when i test the movie the welcome scene works ok but when i click the btn to go to the next scene i get the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at hit_the_ball_onepage_fla::MainTimeline/frame2()

at flash.display::Sprite/constructChildren()

at flash.display::Sprite()

at flash.display::MovieClip()

at flash.display::MovieClip/nextScene()

at hit_the_ball_onepage_fla::MainTimeline/fl_ClickToGoToNextScene()

i tried to move the game to frame 2 and put the welcome page on frame 1 - but the same error appears.

ca someone tell me how to repair the problem?

ehud

TOPICS
ActionScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
May 07, 2012 May 07, 2012

hay hay

i found out the mistake.

no need to dig to the script

thanks a lot

Translate
Community Expert ,
May 07, 2012 May 07, 2012

click file > publish settings > flash and tick "permit debugging".

retest.  the line of code that's trying to reference your null object will be in the error message. 

if that's not enough to help you solve the problem, copy and paste the complete error message and copy and paste the problematic line of code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 07, 2012 May 07, 2012

thanks but it did not work.

this is what i get:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at hit_the_ball_onepage_fla::MainTimeline/frame2()[hit_the_ball_onepage_fla.MainTimeline::frame2:77]

at flash.display::Sprite/constructChildren()

at flash.display::Sprite()

at flash.display::MovieClip()

at flash.display::MovieClip/nextScene()

at hit_the_ball_onepage_fla::MainTimeline/fl_ClickToGoToNextScene_2()[hit_the_ball_onepage_fla.MainTimeline::frame1:10]

i can not identify the problematic line.

this is the full script:

stop()
var maxMove:Number =50;
var bounds:Rectangle = new Rectangle(this.volumeSlider.x, this.volumeSlider.y, -maxMove, 0);
var scrolling:Boolean = false;

function startScroll (e:Event):void {
scrolling = true;
this.volumeSlider.startDrag (false,bounds);
}

function stopScroll (e:Event):void {
  scrolling = false;
  this.volumeSlider.stopDrag ();
}

function enterHandler (e:Event):void {
  if (scrolling == true) {
MovieClip(this.root).setVolume(1-((bounds.x-this.volumeSlider.x)/maxMove));
}
}

function setVolume(vol:Number){
var mod:SoundTransform = new SoundTransform();
mod.volume = vol;
my_channel.soundTransform = mod;
}
   
addEventListener (Event.ENTER_FRAME, enterHandler);
this.volumeSlider.addEventListener (MouseEvent.MOUSE_DOWN, startScroll);
stage.addEventListener (MouseEvent.MOUSE_UP, stopScroll);

import flash.events.Event;
import flash.display.MovieClip;
import flash.filters.*;
var my_sound:SoundId = new SoundId();
var my_channel:SoundChannel = new SoundChannel();
var my_hit:HitId = new HitId();
var my_channel_hit:SoundChannel = new SoundChannel();      
var my_miss:miss = new miss();
var my_miss_hit:SoundChannel = new SoundChannel();
var slidex=1
var radiusw:Number = which_balloon.width
var random_color=Math.random()*0xFFFFFF
var hits:Number = 0;
var check_hits:Number = 1;
var balls_speed:Number=1
var checks=false
var speed=0;
var gova = 0;
var balloon_position=0
var mehirut:Number = speed
var balloon_bevel:BevelFilter = new BevelFilter();

play_btn.addEventListener(MouseEvent.CLICK, playSound)
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
my_channel = my_sound.play();
bow.center.x=0
which_balloon.under_balloon.color=0xffffff
balloon_bevel.angle=45
balloon_bevel.blurX=5
balloon_bevel.blurY=5
balloon_bevel.distance=5
balloon_bevel.quality=3
balloon_bevel.strength=2
balloon_bevel.highlightColor=0xffffff
balloon_bevel.shadowColor=0x000000
BitmapFilterType.INNER

amount.text = String(hits);
check_hit.text = String(check_hits);
ball_speed.text = String(balls_speed);
which_balloon.addEventListener ( Event.ENTER_FRAME,kav);
mehirut_hez.addEventListener ( Event.ENTER_FRAME, hez_mehirut );
bow.meitar_d.addEventListener(Event.ENTER_FRAME, rotateMoveClip_d);
bow.meitar_u.addEventListener(Event.ENTER_FRAME, rotateMoveClip_u);
bow.center.addEventListener(MouseEvent.MOUSE_DOWN, drag);
slide.addEventListener(MouseEvent.MOUSE_DOWN, drag_slide);
slide.addEventListener(MouseEvent.MOUSE_UP, text_slide);
slide.addEventListener(MouseEvent.MOUSE_OUT, drop_slide);      
which_balloon.addEventListener(Event.ENTER_FRAME, bevel);
ashpat_hizim.addEventListener(MouseEvent.CLICK,show_hez)
bow.center.addEventListener(MouseEvent.MOUSE_UP, drop);
hit_arrow.addEventListener(Event.ENTER_FRAME, kadima);
hit_arrow.bullets.addEventListener(Event.ENTER_FRAME,kadima);
hit_arrow.alpha=0;

function drag_slide(MouseEvent){
slide.startDrag(false, new Rectangle(695,555,160,0));

}

function drop_slide(MouseEvent){
slide.stopDrag()

if(slide.x<=735){
  slidex=1
  balls_speed=slidex
  ball_speed.text=String(1)
}
if(slide.x>=736&&slide.x<=775){
  slidex=5
  ball_speed.text=String(5)
}
if(slide.x>=776&&slide.x<=815){
  slidex=10
  ball_speed.text=String(10)
}
if(slide.x>=816&&slide.x<=855){
  slidex=15
  ball_speed.text=String(15)
}


}
//force delay to balloons before starting to move
function kav(e:Event){
var myTimer:Timer = new Timer(2200,1);
myTimer.addEventListener(TimerEvent.TIMER, delay);
function delay (e:TimerEvent):void{
  if(which_balloon.y>=450){
   which_balloon.y-=25
  }
  if(which_balloon.y<449){
   which_balloon.y-=slidex
   //slidex/20
  }

}
if(checks==true){
myTimer.start();
}
if((hit_arrow.x<=0)||(arrows.y>=550)){
checks=false
 
  }

if(which_balloon.y<=10){
checks=false
 
  }
  if(which_balloon.y<=-200){
     which_balloon.y=540
  }
}

//defines the speed for the text box(showa the speed of the arrow)
function hez_mehirut(e:Event){
mehirut=Math.floor(bow.center.x/1.5)*10
mehirut_hez.text=String(mehirut)
}

// what happens when  starting todrag the bpw.center
function drag(MouseEvent){
which_balloon.y=540
spring.gotoAndPlay(2)
random_color=Math.random()*0xFFFFFF
var balloon_color:ColorTransform = which_balloon.under_balloon.transform.colorTransform;
balloon_color.color = random_color;
which_balloon.under_balloon.transform.colorTransform = balloon_color;
radiusw=which_balloon.width*Math.random()*2
if(radiusw<=32||radiusw>=120){
radiusw=80
}
which_balloon.width=radiusw
which_balloon.height=radiusw
balloon_position=1
bow.center.startDrag(false, new Rectangle(0,-50,75,100));
hit_arrow.alpha=0;
hit_arrow.rotation=0
hit_arrow.bullets.rotation=0
checks=true
balloon_position=1
bow.center.startDrag(false, new Rectangle(0,-50,75,100));
hit_arrow.alpha=0;
hit_arrow.rotation=0
hit_arrow.bullets.rotation=0
checks=true
}

//what happens when mouse up after "drag"
function drop(e:MouseEvent):void{

if(bow.center.x>=0&&bow.center.x<=25){
  stopDrag();
  bow.center.x=0;
  demi.alpha=1
  arrows.alpha=0
  demi.gotoAndPlay(2); 
     balloon_position=0
     which_balloon.y=540
  my_miss_hit = my_miss.play();
 
  
}
else{
     speed=bow.center.x/1.5
     stopDrag();
  bow.center.x=0;
  bow.center.y=0;
  arrows.alpha=0
  retet.gotoAndPlay(2);
  gova=arrows.rotation
  hit_arrow.alpha=1
  demi.alpha=0
 
  } 
}

//this controls the hit_arrow speed and orientation
function kadima(e:Event){

var pointx=(which_balloon.x)
var pointy=(which_balloon.y)
var zavit=hit_arrow.rotation
if(hit_arrow.alpha==1&&balloon_position==1){
  yellow.x=which_balloon.x
  yellow.y=which_balloon.y
  hit_arrow.x-=speed;
  hit_arrow.rotation=gova;
  hit_arrow.y-=zavit
}
if(hit_arrow.x<=-1575){
  hit_arrow.alpha=0
 
 
}
       if(hit_arrow.bullets.hitTestObject(which_balloon)){
       my_channel_hit = my_hit.play();
    hit_arrow.y-=25
    hits=hits+1
    amount.text=String(hits);
    checks=false
   
    balloon_position=0
    yellow.gotoAndPlay(2)
    }
    if(hit_arrow.x<=-1500){
    hit_arrow.y-=25
    balloon_position=0
    which_balloon.y=540
    }
    if(balloon_position==0){
   which_balloon.y=755
   hit_arrow.alpha=0  
    }
    if((hit_arrow.x<=0)&&(hit_arrow.x>=-100)){
   my_miss_hit = my_miss.play();
    }
   
}

// what happens when clicking on ashpat hezim
function show_hez(MouseEvent){
spring.gotoAndStop(1)
check_hits=check_hits+1
check_hit.text=String(check_hits);
arrows.alpha=1;
hit_arrow.alpha=0;
hit_arrow.y=275
hit_arrow.x=750
hit_arrow.rotation=0
demi.alpha=0
checks=false
function bevels(e:Event){

}

}

//this function controls the  upper meitar and the arrow
function rotateMoveClip_u(e:Event){
var target=(bow.center.x);
var target_arrow=bow.center.y
    e.target.rotation=((-target)/3.15);
bow.meitar_u.height = Math.sqrt((target-50)*(target-50) + 150*150);
bow.meitar_u.width=(target/20+2);
yad.width =227-target;
yad.height=82
arrows.x=762+target;
arrows.rotation=target_arrow;
}

//this function controlls the down meitar
function rotateMoveClip_d(e:Event){
var target_d=(bow.center.x-7);
    bow.meitar_d.rotation=((target_d)/3.15);
bow.meitar_d.height = Math.sqrt((target_d-60)*(target_d-60) + 150*150);
bow.meitar_d.width=(target_d/20+2);
}
function bevel(e:Event){
which_balloon.filters = [balloon_bevel]
}

function text_slide(MouseEvent){
ball_speed.text=String(slidex)
}

function playSound(event:MouseEvent):void{
my_channel = my_sound.play();
}
function stopSound(event:MouseEvent):void{
my_channel.stop();
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 07, 2012 May 07, 2012
LATEST

hay hay

i found out the mistake.

no need to dig to the script

thanks a lot

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines