J.C. Berry wrote:

> I wondered if I could bother you to review the code below and make comments
> and suggestions.

It's not bad at all, especially for your first class. I didn't go
through all your code, but one thing jumped out at me. These lines
might give you problems:

for(var i=0;i<NumOfCities;i++){
  CityNum = i;
  var DynaBtn = root['city'+CityNum+'_mc'];
  DynaBtn.gotoAndStop(1);
  
DynaBtn.addEventListener(MouseEvent.MOUSE_OVER,DynaBtnRollOverHandler(CityNum));
  DynaBtn.addEventListener(MouseEvent.MOUSE_OUT,DynaBtnRollOutHandler);

First, you are going to have only one DynaBtn variable--the last one
declared in the for loop. Each time you create an instance, it
overwrites the last one. Fortunately for you, it works, but it won't
always.

The second issue is adding an event listener from outside the object.
DynaBtn.addEventListener() will add the listener to the button, but
you won't be able to remove the listener from outside the button.

Instead, you should have a DynaBtn class, and add the listener in the
constructor. Then you can remove the event listeners when you clean
up.

This applies, of course, to all the buttons you created.

Nice job overall, though.

Cordially,

Kerry Thompson
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to