Groups | Blog | Home
all groups > flash actionscript > july 2004 >

flash actionscript : Getting Errors for mistyped paths/functions


loki_mdog
7/28/2004 8:44:53 PM
Hey Flash Gurus --

How do you get flash to throw an error (or warning) in the output box when you
misspell the name of function or path to an object?

The only clue that I have that something is wrong is that the flash movie
isn't acting the way that I want.

So if I have a function that lives at:
someMovieClip.myAwesomeFunction() but I type
someMoveClip.myAwsoeFunctin()

my function won't run and I WON'T get an error saying:
Tried to invoke non-existant function: someMoveClip.myAwsoeFunctin() at line
87.

How do I get an error message like this? How do people deal with tracking
down misspellings to paths/objects/functions? I am used to languages like
perl/coldfusion/java/javascript that will throw an error if you call a function
that isn't in scope.

Many, many, many thanks!

Matt

PS Using Flash MX 2004 Pro...
kglad
7/28/2004 10:14:12 PM
well, you can code call-back to notify you that you've called a non-existant
path/function, but that would require (2) extra lines of code and a typo in one
of those lines would undermine the call-back. so, i'm not sure there's
anything you can do that's dummy-proof.
loki_mdog
7/28/2004 11:09:30 PM
Thanks for the response!

I was kind of hoping that the solution wouldn't be "a roll your own" but would
be included in the engine itself but it looks like that is not the case...Seems
weird that actionscript would act this way when it is based on JS and JS throws
errors when you call a non-existant function.

Or that there might be a way to introduce something that would capture and
report these kind of errors globally (rather than having to include a code
snippet in each function declaration and usage) but I don't know enough about
flash/actionscript to figure out how to do that (or if it is even possible) so
I thank you for your response and help!

Matt
kglad
7/29/2004 6:15:33 AM
yes, i agree some kind of extension of the flash function would be ideal, but i
don't know any way to do that. you can use class to extend movieclip objects,
but i don't know of any analogous extension for functions.
AddThis Social Bookmark Button