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

1180: Call to a possibly undefined method... Possibly?

Engaged ,
Nov 26, 2013 Nov 26, 2013

I have buttons, that when clicked will create an instance in one of 3 movie clips within a movie clip.

For instance, this works just fine:

b_IF_4G5_TOP.addEventListener(MouseEvent.CLICK, b_IF_4G5_TOP_add);

function b_IF_4G5_TOP_add(event:MouseEvent):void

{

var b:MovieClip = new IF_4G5_TOP();

b.name = "IF_4G5_TOP";

layout.substrate.addChild(b);

}

but this does not:

p_conn_h.addEventListener(MouseEvent.CLICK, p_conn_h_add);

function p_conn_h_add(event:MouseEvent):void

{

var b:MovieClip = new PC_H(); <- This line produces this error: 1180: Call to a possibly undefined method PC_H.

b.name = "p_conn";

layout.connectors.addChild(b);

}

Which is odd, because as you can see in the first example, I have not "defined" var b:MovieClip = new IF_4G5_TOP();

Both objects exist in the library, are movie clips, both targets and objects are accuratley named and exist.

Am I missing something obvious? Thanks in advance for your help.

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

Participant , Nov 27, 2013 Nov 27, 2013

Check the PC_H movieclip name have given as linkage name, if yes then check have you given any instance name for the same movieclip. If yes remove the instance name.

or try to change the movieclip name,

var b:MovieClip = new PC_H();

Translate
Enthusiast ,
Nov 26, 2013 Nov 26, 2013

looks good, but I'd try duplicating the bad clip and renaming/classifying it to see if that helps

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
Participant ,
Nov 27, 2013 Nov 27, 2013

Check the PC_H movieclip name have given as linkage name, if yes then check have you given any instance name for the same movieclip. If yes remove the instance name.

or try to change the movieclip name,

var b:MovieClip = new PC_H();

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
Engaged ,
Dec 02, 2013 Dec 02, 2013

Thanks for the suggestions, guys.

I did try renaming the movieclips, no success.

The movieclips that work fine, like IF_4G5_TOP have no as linkage or anything. The code simply places a copy of the movieclip from the library onto the stage within its target movieclip.

I even tried to change their target to the same target as the ones that work:

layout.connectors.addChild(b);

to

layout.substrate.addChild(b);


But no go...

Why do you suppose an identical function would work in one case, but throw errors in another? It's seemingly irrational inconsistencies like this that are so frustrating about actionscript.

Any ideas? Thanks 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
Engaged ,
Dec 02, 2013 Dec 02, 2013
LATEST

I did what you suggested and gave the movieclip PC_H the AS Linkage name PC_H and now it works, the button now places a copy in the target movieclip, but I have one question: Why?

I have no AS Linkage names for the previous movieclips that work... why would I need to do something different for similar movieclips?

How would anyone know to do that from the cryptic and maddening error messages Flash offers?

Like I said, irrational and inconsistent are words that describe actionscript programming all too often...

Thanks for your help, I appreciate it very much!

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