Reputation: 5029
Okay, so i have a bunch of simple shapes in movie clips...
THen, i have "levels" that are each in their own movie clip...
Sometimes in the levels i have to instantiate these random movie clips on the fly and create multiple instances, so ill just do something like
//this up top
var hexagonOne:hexagonOne;
//then this when i need a new one, i need to do it like this so i can make multiple instances...
hexagonOne = new hexagonOne();
This works great..but...
in another movie clip now on my "level 2" movie clip
I literally take the same exact code, that worked in level one...But now it will not work in this other movie clip....
I get this error whenever i try hexagonOne = new hexagonOne();
or ANY other shape movie clip i try to instantiate.
Symbol 'lvl1-2', Layer 'Layer 2', Frame 1, Line 99 1180: Call to a possibly undefined method hexagonOne.
I don't understand because it worked fine inside the other movie clip, which is just like this one...It makes no sense.
EDIT: figured it out, dumb typo on my end.
Upvotes: 0
Views: 841
Reputation: 15955
If you had a symbol in your library with AS Linkage named "hexagonOne", this makes sense:
var hexagonOne:hexagonOne;
hexagonOne = new hexagonOne();
From the timeline, you define a local variable hexagonOne
and instantiate that instance with a type hexagonOne
.
If you have not defined the variable var hexagonOne
in a different scope, it's unknown.
For starters, it'd probably help to follow a naming convention for your symbol to be defined as HexagonOne
then camel case your variable as you have.
var hexagonOne:HexagonOne;
hexagonOne = new HexagonOne();
If each level MovieClip needs to add a hexagonOne
object, each should define var hexagonOne:hexagonOne
and instantiate it with the new keyword.
If that doesn't help, perhaps you should cite more of what your trying to accomplish with specifics of your libary / class / code implementation.
Upvotes: 1