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

I have a problem is an emergency

New Here ,
Feb 01, 2011 Feb 01, 2011

i made a little program in cs5 action script 3 and i have got next error ypeError: Error #1009: Cannot access a property or method of a null object reference.
at Razboiulde30deani_fla::MainTimeline/frame1()[Razboiulde30deani_fla.MainTimeline::frame1:64]

my actions are

stop();
function buton_clicked(e:MouseEvent):void{gotoAndStop("page0")
}
function b1_clicked(e:MouseEvent):void{gotoAndStop("p1")
}
function button1_clicked(e:MouseEvent):void{gotoAndStop("page1")
}
function b2_clicked(e:MouseEvent):void{gotoAndStop("p2")
}
function button2_clicked(e:MouseEvent):void{gotoAndStop("page2")
}
function b3_clicked(e:MouseEvent):void{gotoAndStop("p3")
}
function button3_clicked(e:MouseEvent):void{gotoAndStop("page3")
}
function button4_clicked(e:MouseEvent):void{gotoAndStop("page4")
}
function b4_clicked(e:MouseEvent):void{gotoAndStop("p4")
}
function button5_clicked(e:MouseEvent):void{gotoAndStop("page5")
}
function b5_clicked(e:MouseEvent):void{gotoAndStop("p5")
}
function button6_clicked(e:MouseEvent):void{gotoAndStop("page6")
}
function b6_clicked(e:MouseEvent):void{gotoAndStop("p6")
}
function button7_clicked(e:MouseEvent):void{gotoAndStop("page7")
}
function b7_clicked(e:MouseEvent):void{gotoAndStop("p7")
}
function button8_clicked(e:MouseEvent):void{gotoAndStop("page8")
}
function b8_clicked(e:MouseEvent):void{gotoAndStop("p8")
}
function A_clicked(e:MouseEvent):void{gotoAndStop("page8A")
}
function A1_clicked(e:MouseEvent):void{gotoAndStop("page8B")
}
function A2_clicked(e:MouseEvent):void{gotoAndStop("page8C")
}
function A3_clicked(e:MouseEvent):void{gotoAndStop("page8D")
}
function A4_clicked(e:MouseEvent):void{gotoAndStop("page8E")
}
function A5_clicked(e:MouseEvent):void{gotoAndStop("page8F")
}
function A6_clicked(e:MouseEvent):void{gotoAndStop("page8G")
}
function A7_clicked(e:MouseEvent):void{gotoAndStop("page8H")
}
function A8_clicked(e:MouseEvent):void{gotoAndStop("page8I")
}
function A9_clicked(e:MouseEvent):void{gotoAndStop("page8K")
}
function A10_clicked(e:MouseEvent):void{gotoAndStop("page8L")
}
function A11_clicked(e:MouseEvent):void{gotoAndStop("page8M")
}
function button9_clicked(e:MouseEvent):void{gotoAndStop("page9")
}

buton.addEventListener(MouseEvent.CLICK, buton_clicked);
b1.addEventListener(MouseEvent.CLICK, b1_clicked);
button1.addEventListener(MouseEvent.CLICK, button1_clicked);
b2.addEventListener(MouseEvent.CLICK, b2_clicked);
button2.addEventListener(MouseEvent.CLICK, button2_clicked);
b3.addEventListener(MouseEvent.CLICK, b3_clicked);
button3.addEventListener(MouseEvent.CLICK, button3_clicked);
b4.addEventListener(MouseEvent.CLICK, b4_clicked);
button4.addEventListener(MouseEvent.CLICK, button4_clicked);
b5.addEventListener(MouseEvent.CLICK, b5_clicked);
button5.addEventListener(MouseEvent.CLICK, button5_clicked);
b6.addEventListener(MouseEvent.CLICK, b6_clicked);
button6.addEventListener(MouseEvent.CLICK, button6_clicked);
b7.addEventListener(MouseEvent.CLICK, b7_clicked);
button7.addEventListener(MouseEvent.CLICK, button7_clicked);
b8.addEventListener(MouseEvent.CLICK, b8_clicked);
button8.addEventListener(MouseEvent.CLICK, button8_clicked);
A.addEventListener(MouseEvent.CLICK, A_clicked);
A1.addEventListener(MouseEvent.CLICK, A1_clicked);
A2.addEventListener(MouseEvent.CLICK, A2_clicked);
A3.addEventListener(MouseEvent.CLICK, A3_clicked);
A4.addEventListener(MouseEvent.CLICK, A4_clicked);
A5.addEventListener(MouseEvent.CLICK, A5_clicked);
A6.addEventListener(MouseEvent.CLICK, A6_clicked);
A7.addEventListener(MouseEvent.CLICK, A7_clicked);
A8.addEventListener(MouseEvent.CLICK, A8_clicked);
A9.addEventListener(MouseEvent.CLICK, A9_clicked);
A10.addEventListener(MouseEvent.CLICK, A10_clicked);
A11.addEventListener(MouseEvent.CLICK, A11_clicked);

button9.addEventListener(MouseEvent.CLICK, button9_clicked);

bn1.addEventListener(MouseEvent.CLICK,backward);
bn2.addEventListener(MouseEvent.CLICK,forward);

function forward(event:MouseEvent){
   if(this.currentFrame== this.totalFrames){
    gotoAndStop(1);
   }
   else
   nextFrame();
}


function backward(event:MouseEvent){
   if(this.currentFrame==1){
    gotoAndStop(this.totalFrames);
   }
   else
   prevFrame();
}

TOPICS
ActionScript
1.3K
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
Community Expert ,
Feb 02, 2011 Feb 02, 2011

What's in your frame 1 line 64?

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
New Here ,
Feb 02, 2011 Feb 02, 2011

b1.addEventListener(MouseEvent.CLICK, b1_clicked);

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
Community Expert ,
Feb 02, 2011 Feb 02, 2011

Does "b1" exist?

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
New Here ,
Feb 02, 2011 Feb 02, 2011

yes is an image

which i skiped in a buton named b1(instance name)

and if i cut that line then i will recive the same error at next line and on and on

and on is like that error is not end even if i change the buttons the project work just a

t first frame then freeze if you have yahoo id plz give me so i can show you my project

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
Community Expert ,
Feb 02, 2011 Feb 02, 2011

trace("b1", b1);

What do you get for the trace above?

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
New Here ,
Feb 02, 2011 Feb 02, 2011

i try that and nothing , if i delete the line

with b1 or whatever he said that i ve got problem with buton 2 or every button that is f

irst above the buton(that is the only one that work(from first frame ) and ever

y button from other frame gett error i doțt think that is from button name or s

omething

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
Community Expert ,
Feb 02, 2011 Feb 02, 2011

> i try that and nothing

Ah sorry you're of course getting a compiler error so obviously trace won't do

Your error is saying the object is null (does not exist), which means you do not have the object called "b1" present.

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
New Here ,
Feb 02, 2011 Feb 02, 2011

i will try to see but i have all the buttons on my project

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
LEGEND ,
Feb 02, 2011 Feb 02, 2011

The 1009 error indicates that one of the objects being targeted by your code is out of scope, and based on what you described, they probably all are.  This could mean that the object....


 
- is not in the display list
- doesn't have an instance name (or the instance name is mispelled)
- does not exist in the frame where that code is trying to talk to it
- is animated into place but is not assigned instance names in every keyframe for it
- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
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
Guru ,
Feb 10, 2011 Feb 10, 2011
LATEST

The main problem of your code lies in the fact that you

set up Eventlisteners for every movieclip/button manually instead of doing sth. like:

function addMouseClickListeners():void{

    for (var i:uint = 1; i<=9;i++){

        var btn_name:string = "btn_"+i;

       //Deactivate strict modus for this

        this[btn_name].addEventListener(MouseEvent.CLICK, clickHandler);

   }

}

function clickHandler(e:MouseEvent):void{

    var thisBtnNr:String = e.currentTarget.substr(4,1);

    var thisPage:String = "page"+thisBtnNr;

    gotoAndStop(thisPage);

}

then sth.happens like at first you wrote "buton" later on, "button" and it already gets chaotic after some dozen LOC,

nobody wants to debug sth. like this 😉

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