-
Invoke Class Discrepency?
Hello,
I have no trouble invoking a Class using the code on the main timeline shown below;
var testClass:MyClass = new MyClass(); //code on maintimeline invoke Class.
However, if I were to remove this code and just use the Flash Class Input Field and insert; MyClass //the name of the Class.
I get throwback errors:
1 - Call to possible addFrame Script?
2 - MyClass must subclass flash.display.MovieClip etc
I've tried variations of adding and removing the flsh.display.MovieClip Class
Any feedback would be appreciated.
-
what.
You do not "invoke" a class. You can create a new instance of a class, which is what you're doing on that line. "invoke" has connotations of triggering, running, etc. A class shouldn't be thought of as doing something, rather it is something.
It looks like you are trying to associate MyClass with some instance in your fla, and that instance has frame script on it. Only MovieClips may have frame script, so if MyClass does not extend MovieClip, that won't work.
Be sure that the code belongs in frame script rather than in the class itself. If it is better in the class, then move it there. If it does belong in frame script, then change MyClass to extend MovieClip rather than Sprite or whatever it's extending now.
-
5TonsOfFlax - I'm over her chuckling but tail off at your first response. Thanks for the feedback, it really cleared things up.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|