A few days back I created a simple point and click game and the following error occurred
1180: Call to a possibly undefined method
DisplayObject.
This is my code:
poster.addEventListener(MouseEvent.MOUSE_DOWN, clickposter);
stop();
function clickposter (event:MouseEvent):void
{
removeChild(DisplayObject(event.target));
}
Now the weird thing is, this code worked fine at first but as soon as I added a document class to my project it stopped working and gave me the 1180 error.
My document class is nearly empty:
package
{
import flash.display.MovieClip;
public class Main extends MovieClip
{
public function Main()
{
}
}
}
I have searched around a bit but wasn’t able to solve this error.
Importing DisplayObject into your document class will fix this:
I’m afraid I don’t know exactly what causes the issue as the code for the poster object is separate to the document class code (I assume), sorry it’s not the most informative answer but it’ll get your code working at least.