On Fri, May 30, 2008 at 4:31 AM, yiğit boyar <[EMAIL PROTECTED]> wrote:
> If you want to share data between different files,
> the best approach is to implement a singleton Model class.
There's a lot of discussion about its correctness in AS3, but that's
the way it's always* done on the street.
*[Fundamentalist will disagree]
A quick google on Singleton Design Pattern Actionscript 3 should get you going.
>
> On Fri, May 30, 2008 at 1:31 PM, <[EMAIL PROTECTED]> wrote:
>> [Bindable]
>> public static var TestValue:String = null;
>> However this bindable value was not visible in other mxml files.
Remember that static variables are properties of the class, not of the
instance. Also, the mxml tags that you lay in your application are
instances of the class, not the Classes themselves.
You can bind to static variables of classes, but you have to reference
them through the class, not through the instance.
<mx:Label text={MyTestClass.testValue} />
If you want to bind to an instance of a class (which would include the
instances you instantiate (sorry 'bout the cacophony) with mxml), then
you'd have to make your variable an instance variable, not a static
variable.
<mx:Label text="{myInstance.testValue}" />
<component:MyTestClass id="myInstance" />
package component {
[Bindable]
public var testValue :String; // without the 'static'
}
--
gabriel montagné láscaris comneno
http://rojored.com
t/506.8392.2040