Hi everyone !
I’m getting a REALLY annoing error and hasn’t been able to fix it since yesterday.
I made a “.swc” file as a sound lib (to save space in the SVN, so the sounds, that will be used in many projects get commited only once).
In the first project, everything worked fine.
BUT NOW…
I made pretty much the same imports, put the “.lib” path in the flash defaults and started to get the error:
TypeError: Error #1007: Instantiation attempted on a non-constructor.
with this line:
_mySound = new (path as Class)();
(the variable _mySound is declared up above as a Sound and “path” is a String past as a parameter in the function)
After some digging, I found that I may have to do things this way (although my way didn’t seem me wrong):
var myClass:Class = getDefinitionByName (path) as Class;
_mySound = new myClass();
After this change, I starte to get this error:
ReferenceError: Error #1065: Variable [class ClickCaixa] is not defined.
More digging and a lot of people said that the problem most likely was because the definition of the class/constructor were not public.
But since I use FlashDeveloper, all my classes are automaticly created as public with public constructors…
I’ve tried a few more stuff, like putting the sound in the fla’s library and redirecting the class for it, but it hasn’t solved.
Can someone please give me a direct answer for that ?
Thank you so much !