Re: central up to date data
Stephen Downs <[email protected]> Fri, 19 Oct 2007 15:10:40 -0700
| Newsgroups | gmane.comp.web.flashcoders.devel |
|---|---|
| Message-ID | <[email protected]> |
You're probably running into this because you're attempting to use
instance variables like static variables.
If you're just storing one variable, you can use a single static
variable in your ancestor class.
If you wanted to access this variable akin to a local property of
specific extended child class instances, you could wrap it in an
accessor. I'm thinking of something like the following.
// --------------------------------
// In Utils.as:
private static var _colorValues:Array;
public function get colorValues():Array {
return Utils._colorValues;
}
public function set colorValues(newVal:Array):void {
Utils._colorValues = newVal;
}
// --------------------------------
// In Application.as, which extends Utils.as:
// Inside some function, let's get _colorValues:
trace(this.colorValues);
// --------------------------------
This is totally untested, just off the top of my head.
Steve
On 2007-10-19, at 2:40 AM, Tom Huynen wrote:
> Hi List!
>
> I'm using a class named utils.as to store data like color values in my
> project.
> This class is then extended by let's say the application.as and the
> menu.as.
>
> Next in the application class I change the value of a var in the utils
> class.
> When retrieving this value from the third (menu) class I still get
> the old
> value instead of the new one.
>
> What is the best thing to do when I want to keep my data central,
> up to date
> and accesible for all classes in my project?
>
> Kind regards,
>
> Tom
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders