0

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?

13
  • debug your movie (ctrl+shift+enter) instead of running it (ctrl+enter), you will have more information about the problem i think. After that make sure you don't have a symbol named Resource on your timeline and that you have a livrary symbol exported for actionscript with the name Resource Commented Feb 12, 2014 at 4:53
  • Shouldn't the var resources:Array = new Array(1); instead of 0? Commented Feb 12, 2014 at 4:55
  • If you comment the code and still have the error, the error is not there ;) Commented Feb 12, 2014 at 4:55
  • Is Resource defined as a static class? Commented Feb 12, 2014 at 4:57
  • ctl+shift+enter didn't make a difference I have a lot of nested timelines, but the find and replace search for the symbol Resource came up with no results And the library symbol has export for actionscript with the name Resource Commented Feb 12, 2014 at 4:58

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.