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

SWC Code doesn't run.

Contributor ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

I have an SWC set up so that it imports into another FLA. In the FLA, I have some code like this:

var mp:MovieClip = new MP() as MovieClip;

addChild(mp);

MP is a MovieClip in the SWC typed as a class called 'MP'.

MP has code in it that should execute when it's added. But it doesn't. Does anyone know why?

Thanks in advance.

Views

256

Translate

Translate

Report

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 ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Hi.

Please try...

var mp:MP = new MP();

addChild(mp);

... and see if it works.

If not, can you provide the files?

Regards,

JC

Votes

Translate

Translate

Report

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
Contributor ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Thanks for replying!!

Doesn't work. At least not any better than what we had.

How do i get you files? I'd love to troubleshoot this without that bother though.

Essentially, I have code that is unwrapped (not in a function) and should simply execute when this thing is added (set up listeners, init stuff, blah blah). And it doesn't execute on launch.

If I put it in an 'init()' function and call it (mp.init()), it works. But I'd rather it just execute automatically.

Votes

Translate

Translate

Report

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 ,
Jun 22, 2019 Jun 22, 2019

Copy link to clipboard

Copied

LATEST

Hi.

I see.

Please upload to Google Drive, Dropbox, WeTransfer, or any other file sharing service and paste the link here if this is not a problem for you.

Regards,

JC

Votes

Translate

Translate

Report

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