1 person found this helpful
The handler function for an event needs to recieve an event:
You don't say which version of Flash you are using. The best documentation however is in Flash. Just put the cursor on addEventListener and press F1.
Usually I scroll down to the bottom of the help entry and there will be examples. It does differ a bit between AS2/3 and CS4/5.
i am pretty sure that is one of the things i tried (from an example on another website). it gave me the "possibly undefined" error. But i wont get a chance until monday to give it a try. By the way, how can anything in programming be "possibly undefined" either it is or its not. programming doesnt work too well with "possiblies" thrown into the mix. Sorry for the misstypings....this forum entry system is not very Android compatible. i cant go back and fix things.
It's possible that what you are calling logolink is actually the class name of the object instead of the instance name. If it is a manually placed object, the instance name is what you assign to an object via the Properties panel after it has been placed on the stage.
logolink.addEventListener(MouseEvent.CLICK, callLink); // changed movieClipName
Granted, indicating "possibly undefined" is a bit erroneous, but you'd have to have come from the world of AS1/2 to appreciate that you are at least being told something is wrong. And if you were to go into your Flash Publish Settings and select the option to Permit Debugging, for that error it would add the line number for the code with the problem. AS1/2 would more likely just not work and leave you to wonder why.
Maybe saying "possibly undefined" is another way of saying ... "you might be trying to use a proper bit of code, but it's not proper here", rather than just outright saying "you messed up, fool, figure it out"
I'd like to see further improvements in the error messaging. Too often the compiler knows exactly what tripped it up, but gives a generic message that forces you to search for whatever the heck it's talking about. But hey, as I said, compared to AS1/2, what it does now makes life easier.
That's probably what it is. I set a class in the library, and not an instance in the stage (do I have that right?).
I forgot to mention (it was asked earlier). I am using CS5 and publishing Flash Player 10 (not sure which he cared about).
So, from what I gather, AS3 is much more complicated (for example a link for a symbol in AS2 took only a line or two of code, and now it takes 9), but it has better debugging and is more powerful. Seems odd. In other languages that I've used, as they mature over time they get better debugging and more power, but they get simpler as well (especially for really common tasks -- like adding a simple link :-P).
Just consider that AS3 is still an infant... the "mature over time" aspect has yet to happen... With each new version of Flash they are still adding new things to the language, not refining what's already in it (unfortunately).
Thanks for the help guys. It was the instance name instead of the class name that solved it. It also needed the "(e:MouseEvent)" so thanks to both of you.
I still have a lot to learn, and this forum is extremely helpful!