FlashComGuru Home Influxis ImediaseeUvault
                                                                                       Forum Index | Active Topics | Register
                                                                                                          List Overview | List Archives
                                                                                                                           About this site | Advertise
 

home

Adobe AIR (11)
Applications (41)
Books & Training (11)
Collaboration (18)
Components (11)
Events (87)
Flash Player (47)
Flex (41)
FMS (114)
General (128)
Hosting (6)
Jobs (17)
Off topic (43)
OSMF (5)
Press Releases (24)
Site Check (11)
Tools (56)
Videos & Players (74)

Follow me on Twitter

 
Here's a little gotcha that hasn't been getting as much attention as I think it should and several people in different forums have had a tough time debugging this. Flash 8 has introduced some new reserved words which may break compatibility with older files once these are compiled to Flash 8. the words are 'move', 'draw' and 'load'.

Assume that you have a class which dispatches events called load, draw or move.

var myListener:Object = new Object()
myListener.load = function(evt) {
trace("loaded");
}
myListener.move= function(evt) {
trace("moved");
}
myListener.draw = function(evt) {
trace("drawn");
}
myObject.addEventListener("load",myListener);
myObject.addEventListener("move",myListener);
myObject.addEventListener("draw",myListener);

None of these event will fire once compiled as Flash 8. Instead you should rename your events to something like 'loaded', 'drawn' and 'moved'.

A closer look at mx.events.EventDispatcher reveals this:

// these events do not get called via backdoor because of name collisions with other methods
static var exceptions:Object = {move: 1, draw: 1, load:1};

I came across this problem when using Peldi's XMLManager class which is part of his FLVPlayer. The XMLManager simply stopped working in Flash 8 and it took some combined efforts to track down the root of the problem.

Thanks to Will Law and Frederic v. Bochmann for their help.

Comments
[Add Comment]
Wow. Good to know, since I do just that often. Actually I didn't believe you at first and set out to prove you wrong, then noticed your reference to the EventDispatcher class. There it is. Thanks!

Technically, though, they are not "reserved words" of Flash 8 or AS2. That term is generally used for an identifier that should not be used anywhere in the language. You just can't use them with that particular class.
# Posted By Keith Peters | 10/14/05 1:22 PM
thanks Keith, you're right of course, reserved words may be the wrong term. Not sure what else to call it though :-)
# Posted By stoem | 10/14/05 2:10 PM
Stefan,

This saved my night! Thanks! I've been running into the same issues.

Jens
# Posted By Jens | 4/11/06 5:06 AM
Great, glad it was of some use!
# Posted By stoem | 4/11/06 9:31 AM