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

gotoAndStop not working at all...

Guest
Dec 18, 2013 Dec 18, 2013

Idk why but when ever I use gotoAndStop(3); (3 is just for example) it doesnt work. It has nothing to do with the code around it. Ive tried it in my first function like this,

function BeginCode(event:Event):void{

     gotoAndStop(3);

}

BeginCode();

AND IT DOESNT WORK! It keeps coming up with the error "Cannot access a property or method of a null object reference." and I cant figure it out ive searched EVERYWHERE ON THE FORUMS. I made an account to only post this one question. My project is due tommorow and Ive been trying to fix this one bug for several day, (I am a student in grade 8). Ive coded before and used other languages. PLEASE HELP ME I WANNA KILL MYSELF OVER THIS STUPID BUG!!!! (sarcasm about killing myself, just realllllyyy stressed.). Is there some preference or option im not seletcting or what!?! I just cant use gotoAndStop at all!!!!

Please help quickly ;(

Thanks for any help you can send my way.

TOPICS
ActionScript
605
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 ,
Dec 18, 2013 Dec 18, 2013

If there is no event driving that function then get rid of the event:Event part of it.  You have to have passed an event in order to have that mean anything.

function BeginCode():void{

     gotoAndStop(3);

}

BeginCode();

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
Dec 18, 2013 Dec 18, 2013

I did have a event in the function that was just a snipit example.

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 ,
Dec 18, 2013 Dec 18, 2013

you need to find your null object reference.  otherwise, none of your code will work after that error appears.

click file>publish settings>swf and tick "permit debugging".  the location of the problematic line of code will be in the error message.

if that doesn't make the solution obvious to you, copy and paste the error message along with the line of code mentioned in the error message.

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
Dec 18, 2013 Dec 18, 2013

TypeError: Error #2007: Parameter hitTestObject must be non-null.

          at flash.display::DisplayObject/_hitTest()

          at flash.display::DisplayObject/hitTestObject()

          at BlockBreaker_fla::MainTimeline/moveBall()[BlockBreaker_fla.MainTimeline::frame2:83]

Cannot display source code at this location.

it doesnt point to a line in the output tab.

EDIT: this is the code i need to fix in my game, not the code from the example. If I use the example i said at the beginning i get this error:

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

          at BlockBreaker_fla::MainTimeline/beginCode()[BlockBreaker_fla.MainTimeline::frame2:25]

and point to this in the output tab:

mcPaddle.addEventListener(Event.ENTER_FRAME, movePaddle);

that is the next action in my function

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 ,
Dec 18, 2013 Dec 18, 2013
LATEST

you have 2 different error messages.  you should correct the error message that appears, first.  that may solve the 2nd error message.

the first error message you posted references an error in frame 2, line 83.  the 2nd error references an error in frame 2, line 25.

if the code you posted is one of those lines, mcPaddle doesn't exist when your code executes.

if you think it does exist on-stage in frame 2, make sure the first keyframe that contains it is frame 2 (ie, it does not appear in frame 1) and select it on-stage and check the properties panel.  because typos can be difficult to see it's best to copy the instance name and paste that into your code or copy the actionscript reference and paste that into the properties panel.

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