A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Why is this statement not permitted in a class definition?

  1. #1
    Senior Blender blastbum's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    276

    Why is this statement not permitted in a class definition?

    Hi,

    Would someone be able to tell me why the following statement is not permitted in a class definition?

    PHP Code:
    class utils.LoaderListener
    {
        
    _global.utils.LoaderListener = function ()
        {
        };
    // End of Class 
    Your help will be greatly appreciated.

    Regards,

    Blastbum

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    because that is completely improper object oriented programming.

    There should be no need for _global variables/functions. But why it's failing is because a class definition only holds variables/functions local to that class. Hence a "class definition". If you must define that _global function, do it inside of the constructor or inside of another method.

  3. #3
    Senior Blender blastbum's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    276
    Hi MyFriendIsATaco,

    Please excuse my ignorance, but if the class definition only holds variables/functions local to that class, then how is the code supposed to look? I have attached two ".as" files, the first one "LoaderListener.as" is the file with the code that I pasted above and the second one "MCListener.as" is the only file that directly refers to the "LoaderListener.as" file. If you could let me know what the code should be for the code I pasted above, that would help me out big time.

    BIG appreciations MyFriendIsATaco.

    Regards,

    Dan (aka Blastbum)
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center