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

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

Explorer ,
Oct 28, 2015 Oct 28, 2015

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

TOPICS
ActionScript
1.2K
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

Enthusiast , Oct 29, 2015 Oct 29, 2015

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.

Translate
Enthusiast ,
Oct 28, 2015 Oct 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.

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
Explorer ,
Oct 28, 2015 Oct 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

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
Enthusiast ,
Oct 28, 2015 Oct 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.

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

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

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

I've tested the App and I've seen a strange thing as I couldn't know the reason maybe you have to check it and find the reason to solve it.

the wrong is that when the timeline being on last key frame and I press home btn, the button (levelOne) in "home" key frame disappears by itself! and one more button also in the same key frame.. that's why you're getting the error, so you have to check why those buttons disappears?!

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

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.

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

I added the event listeners in the first frame to make links to (home,info and help) on the layer ( my menu) and I added frame until the last frame.

as I mentioned above, there are no any errors regarding the first and the second loader, only the run-time error when I add the third loader.

however, thanks I solved the error by make movie clip instead of loading swif file, it works same the loader

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

Exactly that is what you need, as it's more practical.

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

do you mean making movie clip instead?

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

For example in the first key frame you've added these two event listeners to the home button

home_btn.addEventListener(MouseEvent.CLICK, intro_ClickToStopAllSounds_1);

home_btn.addEventListener(MouseEvent.CLICK, home_ClickToStopAllSounds_3);

then you moved to another key frame but the home button still listening for that two events, then when you click the home button the functions ClickToStopAllSounds_1 & ClickToStopAllSounds_3 will not be accessible from your current frame, that will cause an error.. so you have to remove the listeners before you go to another key frame.

you have to check all the buttons not only the home button.

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

nezarov

I think you are right, I will try it again after removing the duplicate listeners

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

بالتوفيق أخي

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

الشكر لك أنت

هل أنت عربي؟

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

نعم أخي أنا من سوريا بس ما حبيت احكي عربي لأنه ما حدا رح يفهم

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

مرحبا بك أخي الفاضل وشكرا على المساعدة

هل من الأفضل عمل موفي كليب بدلا من استيراد ملف سويف؟

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

عفواً أخي وأهلا وسهلا فيك

بخصوص الفريمات لو بتخلي الأزرار العامة متل الهوم والإنفو بطبقة تانية مع الأوامر الخاصة فيهم بحيث تقدر تستخدمهم من أي فريم

أما الأزرار الخاصة بكل صفحة فخليهم على حالهم

المفروض دائماً تستخدم هالاسلوب لأنه عملي أكتر

تحياتي وموفق

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

لا الأفضل الاستيراد عشان حجم التطبيق يكون صغير

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

شكرا مرة أخرى ، سوف أستمع لنصحك

وسوف أحاول ذلك مرة أخرى

هل يمكن أنتسمح لي بالتواصل معك عبر فيسوبوك أو أي وسيلة اتصال؟

Thanks again, I will listen to advice

I will try it again

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
Enthusiast ,
Oct 29, 2015 Oct 29, 2015

العفو وأهلا بك

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
Explorer ,
Oct 29, 2015 Oct 29, 2015

I've tried everything you advised me to do, but the problem still as it is not resolved.

Can you help me and correct coding in the file and then send it to me?

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
Explorer ,
Oct 31, 2015 Oct 31, 2015

I've been having a problem related to Flash project  Android, app, I asked help from Forum members, You helped me to solve it.

Thanks Nezarov

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
Enthusiast ,
Oct 31, 2015 Oct 31, 2015
LATEST

You're welcome thank you too.

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