Skip to main content
Known Participant
October 28, 2015
Answered

run time error when go to home button after loading external swf

  • October 28, 2015
  • 1 reply
  • 1433 views

I work on develop Android App for learning Arabic, it is very simple.

to explain the alphabet, I create and I load external swfs files, first and the second loaders are working good (loading and when click any buttons there are no any issue)

but the third loader is loading good also, but the problem when I test the project, I get run time error when press home button.

(it does not happen when loading the other loaders)

here is the sours files Android Project.rar - Google Drive

Thanks

This topic has been closed for replies.
Correct answer nezarov

there is no error when I remove the last loader from the frame

and I need the home button to go back from other frames. it works well without the third loader


the problem is in the way you're using to add the event listeners to the buttons, you're adding a different click event listener for them every key frame, so you have to remove the listeners before you leave to another frame.

1 reply

Inspiring
October 28, 2015

Can you copy and paste the error here? or the code that you think it's causing the error.. maybe someone can help you, thanks.

Known Participant
October 28, 2015

to make it easier I enclosed a link to the source files of my project ( it contains 10 frames only)

No compiler error, it is run-time error

by the way there are no error when I remove the loader from the frame

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

  at LearnArabic_fla::MainTimeline/frame1()[LearnArabic_fla.MainTimeline::frame1:74]

  at flash.display::MovieClip/gotoAndStop()

  at LearnArabic_fla::MainTimeline/home_ClickToGoToAndStopAtFrame_3()[LearnArabic_fla.MainTimeline::frame1:120]

link to the files

Android Project.rar - Google Drive

Thanks for your advice

Inspiring
October 28, 2015

your file contains TLF text fields and it's no more supported in flash cc so I can't test the file.. as it's contains a lot of frames and script lines that will not be easy to understand.. anyway as I see in your reply the error in the line 120

home_btn.addEventListener(MouseEvent.CLICK, home_ClickToGoToAndStopAtFrame_3);

function home_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void

{

    gotoAndStop("home");// line 120

}

This function in frame 1 and the frame name is "home", so the timeline already on frame "home", so you don't need this function remove it and try.