ReferenceError: Error #1065: Variable SimpleMP3Player is not defined.
I needed to make a simple flash mp3 player in about two hours today. I quickly setup my classes, launched my application, and this is the error that I got:
ReferenceError: Error #1065: Variable SimpleMP3Player is not defined.
I had set the linkage, in the linkage properties, of a symbol to point to the class SimpleMP3Player.
The class was written as follows:
1065 Variable _ is not defined. You are using an undefined lexical reference. For example, in the following statements, the statement trace(x) generates an error because x is undefined. However, the statement trace(y) doesn't generate an error because y is defined:
trace("hello world")
trace(x) // x is undefined
var y
trace(y) // No error, y is defined.
It didn't take too long to see that I had simply forgotten to declare the class SimpleMP3Player as public. Nevertheless, there could have been a much better error for this. When you take your compiler classes, they always teach you to include common errors in your parser so you can provide useful error messages. Apparently the Adobe AS3 developers weren't paying attention.
ReferenceError: Error #1065: Variable SimpleMP3Player is not defined.
I had set the linkage, in the linkage properties, of a symbol to point to the class SimpleMP3Player.
The class was written as follows:
packageI checked the adobe live docs and read:
{
import flash.display.*;
class SimpleMP3Player extends MovieClip
{
function SimpleMP3Player()
{
trace("MP3 Player instantiated");
}
}
}
1065 Variable _ is not defined. You are using an undefined lexical reference. For example, in the following statements, the statement trace(x) generates an error because x is undefined. However, the statement trace(y) doesn't generate an error because y is defined:
trace("hello world")
trace(x) // x is undefined
var y
trace(y) // No error, y is defined.
It didn't take too long to see that I had simply forgotten to declare the class SimpleMP3Player as public. Nevertheless, there could have been a much better error for this. When you take your compiler classes, they always teach you to include common errors in your parser so you can provide useful error messages. Apparently the Adobe AS3 developers weren't paying attention.


11 Comments:
This happened to me today. I was going nuts trying to figure out where I went wrong until I came across your post. Thanks!
Thank you. Your explanation was spot-on, unlike Adobe's.
Good call on the public class thing. I was battling this error for the longest time!
Thanks for this post. I know I have to declare my classes as public, but today, I just forgot. Good thing I came across your post.
I've got the same error popping up on two machines. The strange part is that two weeks ago when I put the project on hold everything was working perfectly. Secondly, I am receiving this error for mx.containers::Grid. This is especially weird because I'm creating the Grid component in MXML. Any thoughts as to why?
Hi there, and thanks for your post. Not much information in regards to this out there...
I however get this errer regardsless of what I'm trying to do. Really annoying. Even though I don't have any variables in my class (just to check), I get this cryptic message. Any suggestions?
Just joining in on the thanks list - I'm rebuilding my AS2 site in AS3 and fell down on the Document Class immediately because I forgot the magic word "public". Thanks for the simple solution, and best of luck.
Thank you very much for posting this. You just helped me solve the exact same problem! public class... *grumble* :)
thanks man, it helped me a lot!
thanks man, it was helpful
I read this solution but still didn't get it at first for some reason. I had made the constructor public and thought that was it. But of course you actually have to make the class public.
If you're still having problems, maybe you are actually getting the error because of the example in the Adobe description, which is using a variable without declaring it.
Post a Comment
<< Home