One way is to use singleton classes.
# package pkg {
#
# public class SingletonClass {
#
# public var someVar:String = 'Hello World';
#
# //singleton instance makes sure there is only one instance of the class
# static private var myInstance:SingletonClass;
#
# public function SingletonClass( singletonEnforcer:SingletonEnforcer ){}
#
# //returns an instance to the node and enforces singleton class
# public static function getInstance( ): SingletonClass {
#
# if( SingletonClass .myInstance == null )
# SingletonClass.myInstance = new SingletonClass( new
SingletonEnforcer() );
#
# return SingletonClass.myInstance;
# }
#
# }
# }
#
#
# //publicly inacsessable dummy class used to enforce signleton
# class SingletonEnforcer { }
Your class instance could then be accessed anywhere in the application with:
# import pkg.SingletonClass;
#
# trace( SingletonClass.getInstance().someVar );
Regards,
~Aaron
On 2/22/08, dsds99 <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> Yes, using global variables was easy solution to referencing
> movieclips from anywhere.
>
> I'm trying to link up my play button to play the selected track in a
> listbox. The two components are in separate classes.
>
> one solution is that in my main class I pass a reference of the
> listbox to my playbutton.
>
> Are there alternative solutions to this...Better OOP practice.
>
>
--
Aaron Miller
Chief Technology Officer
Splash Labs, LLC.
[EMAIL PROTECTED] | 360-255-1145
http://www.splashlabs.com