Wednesday 18 September 2013

1180 error:Call to a possibly undefined method addFrameScript in as3

Sol 1 :-

Let me get this straight: you have set a Document Class in fla properties and are writing code directly in fla as well?
If this is the case, solution is simple: either write your code only in external .as files and not fla or do not use Document Class if you wish continue writing code on the Timeline. The error code you get states that you have code on your Timeline which behaves like a MovieClip, while your Document Class extends Sprite and therefore is not aware of method called addFrameScript (this method is called while compiling code that is on the Timeline into SWF file).
In short, I'd adviced you to change


public class SetTimeoutExample extends Sprite {
to
public class SetTimeoutExample extends MovieClip {

and move all your fla code to Document Class



Sol 2 :-

I solved the problem and now I'm successfully using an external AS class while implementing some other function on the TimeLine:

The problem can be solved just following this simple "rule":

if you want to JUST load everything from the external CLASS, you have to "link" the .fla file to the .as ("Document Class"):

the timeline use the addFrameScript function

if you want to USE something from the class, while doing something else on the timeline, you JUST HAVE TO PUT a similar line on the TimeLine:

var myClassObject:myClass = new myClass();
this.addChild(myClassObject);

No comments:

Post a Comment