Skip to main content
jeffery wright
Inspiring
November 26, 2013
Answered

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

  • November 26, 2013
  • 2 replies
  • 5120 views

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.

This topic has been closed for replies.
Correct answer lalitha subramanian

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();

2 replies

lalitha subramanianCorrect answer
Inspiring
November 28, 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();

jeffery wright
Inspiring
December 2, 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.

Participating Frequently
November 26, 2013

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