Skip navigation
Currently Being Moderated

Undeclared class variable not reported.

Jul 2, 2012 11:14 AM

Hi,

 

I recently spent an hour locating a resource leak source. It was caused by an undeclared member variable. I mistakenly assumed that AS3 would show a compile error when an undeclared variable is used. Is this a shortcoming of AS3 or is there some way to enable this type of error checking?

 

Thank you.

 
Replies
  • kglad
    62,234 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 2, 2012 12:32 PM   in reply to hhhhhhhhhhhhhh5

    i've never seen that or heard anyone else report that.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 3, 2012 11:42 AM   in reply to hhhhhhhhhhhhhh5

    Never heard of that either. Do you have Stict Mode turned on in ActionScript settings?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 3, 2012 5:06 PM   in reply to hhhhhhhhhhhhhh5

    What was the nature of the resource leak? I find that Flash sometimes cares about this and sometimes doesn't (I suspect it has to do with the way the parent Class is defined, but haven't pinned this down). My current theory is that when your Class that doesn't declare the instances is the Base Class (and not the Class itself), then when Flash generates the Class for you it will also declare the instance variables in many, but not all, cases. One case I have seen where it did not do this was the instances themselves were fl.controls.RadioButton. Those things are sort of wonky anyway, so it's hard to say if Flash Components are the cause or the fact that the instances declare their Class in the Class field and not the BaseClass field, or if there was something completely unrelated.

     

    That's the problem with pushing Flash in directions the Adobe engineers weren't directly expecting--most stuff like this is completely undocumented and you have to figure it out for yourself.

     

    I quite often have undeclared variables (when I'm using the name of the instance to figure out what piece of data to populate the instance with, for example, but don't otherwise care about those instances), so if I'm likely to create memory leaks, it would be good to know this.

     

     

    If you do figure it out, please blog it

    Regards;

     

    Amy

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points