dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Multiple classes in single file

  1. #1
    Heli Attack! iopred's Avatar
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    923

    Multiple classes in single file

    In Flash 9 Beta, it was acceptable to use 'helper' classes similar to Java by creating a non public class inside a file eg:

    Code:
    package com.iopred
    {
    public class Stuff
    {
    }
    
    class Cheese
    {
    }
    }
    And you would only use and manipulate "Cheese" objects inside the "Stuff" class.

    With CS3 this now creates an error. I have tried using the 'internal' flag on the Cheese class however this does not work. Is there a new keyword I am missing? Or is Adobe just making life hard?
    Christopher Rhodes
    squarecircleco.

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    it needs to be outside the package{} block

  3. #3
    Heli Attack! iopred's Avatar
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    923
    Thanks Senocular, always on the ball.
    Christopher Rhodes
    squarecircleco.

  4. #4
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    welcome

  5. #5
    Flash Your Flex
    Join Date
    Apr 2007
    Location
    Provo, Utah
    Posts
    45
    how would you instantiate the Cheese class?

  6. #6
    Heli Attack! iopred's Avatar
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    923
    Only inside Stuff, the same as normal.

    c:Cheese = new Cheese()

    Outside of the Stuff class, Cheese doesn't exist.
    Christopher Rhodes
    squarecircleco.

  7. #7
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    if you need it to exist outside of Stuff (and be accessible elsewhere), it would need to be defined in its own AS file.

  8. #8
    Flash Your Flex
    Join Date
    Apr 2007
    Location
    Provo, Utah
    Posts
    45
    Sweet, thanks guys

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