user2956947
user2956947

Reputation: 239

Flash AS3: 1026 Error: Constructor functions must be instance methods

When I run my code it gives me a compiler error 1026 that says "Constructor functions must be instance methods". It sends me to the movieclip that contains this code, although even if I comment it out, it sends me to the same spot

var resources:Array = new Array(1);
var enemies:Array = new Array();
resources[0] = new Resource();

I saw other people with the same error, but their problems were all spelling mistakes on the name of the exported object.

Any ideas?

Upvotes: 0

Views: 1973

Answers (1)

user2956947
user2956947

Reputation: 239

I think what happened was that the symbol hadn't been given time to load yet, so resources hadn't been initiated by the time I tried to make changes. I changed the array initiation so that it happens in the code that I use to access it, and it doesn't give the error anymore.

Upvotes: 1

Related Questions