dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Global variables

  1. #1
    THE YELLOW FLASH!
    Join Date
    Feb 2008
    Posts
    57

    Global variables

    IS there any way to create global variables than making it static in class??Like to access some variables in a frame in another frame?
    The CodeBreaker!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I assume you meant "[other] than making it static in [a] class".

    If you want your information truly available anywhere without having to pass references along you will have to use some static variables. You could just make each variable you care about static in whatever class it belongs to. Or you could create a class just to group these static variables. Or you could create a singleton with instance variables which just has a single getInstance static method which returns the one instance of that class.

    But in general, the need to do this indicates an incompletely thought out design. Also, frames are more like different points in time than different places in space. You cannot refer to something in the future because it's not set yet. Do not use frames as containers. They are for animation and sequential content.

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