ActionScript 3 Error: 1180: Call to a possibly undefined method CustomClass.
ActionScript 3 Error #1180 Description:
One reason for this this error is because you are using the name of the variable that you are assigning to the Class rather than the Class itself. Adobe also states that this error will only display when “Strict Mode” is turned on.
Flex / Flash Error #1180 Fix:
Make sure that when you instantiate the Object that you are using the Class name and not the variable name.
Bad Code:
var myCustomClass:CustomClass = new myCustomClass();
Good Code:
var myCustomClass:CustomClass = new CustomClass();
Links:
http://www.flashcomguru.com/index.cfm/2007/4/17/Flex-Builder-2-to-write-AS3-code-for-Flash
This should help you resolve Flex / Flash Error #1180
Thanks and as always Happy Flashing
Curtis J. Morley
Hi
when i calling a ‘getter function’ from the class constructor i get this ‘error’.
its clear the the class did not read the setter/getter functions thats why i get the error.
anyway, what i need is not the getter function but the updated varible that the setter updates, but if the Set Function called after the constructor Function, how can i get the updated variable from the class constructor(No FlashVars).
if i wasn’t clear please say it
Thanks
Hi,
I found one more cause of this error. In my current project I’m using my ‘Main’ class as document class. Hence I don’t have anything on stage, only 1 frame without code. In the document properties I mentioned the class name and when tested I got the error saying:
ActionScript 3 Error: 1180: Call to a possibly undefined method addFrameScript.
After spending few minutes I found the stupid reason. By mistake I had typed a ” ” [space] in the first frame. Action-Frame panel was not displaying anything because there was only single character in it – ‘space’. But when I checked first frame in the time-line it was showing that there is some script in the first frame. On checking the Action-Frame I found an unwanted ‘space’ and removed it from there. Error solved.
Hope you find this helpful and be careful while coding. Stupid typos waste a lot of time.
-Dipen
Hi Curtis,
I was searching for the solution of this error and found your blog. I read it and solved the problem in less than 30 seconds.
In my case, the class name was same as the object name and hence Flash was firing this error.
Thanks a lot.
-Dipen
public function showChildren(dispObj:*):void {
for (var i:int = 0; i<dispObj.numChildren; i++) {
var obj:DisplayObject=dispObj.getChildAt(i);
if (obj is DisplayObjectContainer) {
trace(obj.name,obj);
showChildren(obj);
} else {
trace(obj);
}
}
}
showChildren();
This is code i found from a book i am reading and am trying to incorporate it into my own code to see and understand the display list.
But when i run the swf i get the following error…
1180: Call to a possibly undefined method showChildren.
I am fairly new to this so any ideas would be really useful
Thanks
In Flex Builder, the message above apears when I use a class (bitmap picture inside the library of Flash that I’ve made a linkage). Ex.:
private var backgroundImageData:BitmapData = new BackgroundMap(0, 0);
where BackgroundMap is a bitmap file inside Flash library with a linkage (flash.display.BitmapData).
How to workaround that?
(Sorry my english)
Another example of getting this “error” is by forgetting the keyword “public” in front of the class declaration;
class class_name
{
//Not public
}
public class class_name
{
//Public 😀
}