Re: [Flashcoders] central up to date data

2007-10-24 Thread Rich Rainbolt

Unsubscribe Remove


On Oct 19, 2007, at 4:49 PM, David Ngo wrote:

You may want to look into using a Singleton or static class,  
depending on

how you have things implemented and what the desired functionality is.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom  
Huynen

Sent: Friday, October 19, 2007 5:41 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] central up to date data

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] central up to date data

2007-10-24 Thread Rich Rainbolt

Unsubscribe Remove


On Oct 20, 2007, at 5:21 AM, Michael Ypes wrote:

Great to have the list back, I was worried for a while that it was  
gone

forever, phew

In answer to your question:

Create a singleton class which stores all data. I use this in  
applications
to store data from xml files and use it as a mvc pattern. This way  
you can
extract the information from the data anywhere in the application  
by using

the getInstance() method.

EG.

ModelData.getInstance().getMenuColor()

Which would then return the color that you are after.

Read Joey Lotts book AS3 with Design Patterns - which can be easily
translated for AS2 but really helps on building a usable  
architecture for

your applications which are scaleable and usable.

If you require an example then shout again. Bit rushed at the mo.

Cheers

M

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom  
Huynen

Sent: 19 October 2007 10:41
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] central up to date data

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] central up to date data

2007-10-21 Thread Michael Ypes
Great to have the list back, I was worried for a while that it was gone
forever, phew

In answer to your question: 

Create a singleton class which stores all data. I use this in applications
to store data from xml files and use it as a mvc pattern. This way you can
extract the information from the data anywhere in the application by using
the getInstance() method.

EG.

ModelData.getInstance().getMenuColor()

Which would then return the color that you are after.

Read Joey Lotts book AS3 with Design Patterns - which can be easily
translated for AS2 but really helps on building a usable architecture for
your applications which are scaleable and usable.

If you require an example then shout again. Bit rushed at the mo.

Cheers

M

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom Huynen
Sent: 19 October 2007 10:41
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] central up to date data

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] central up to date data

2007-10-20 Thread Bob Leisle

Hi Tom,

It's a bit hard to tell without seeing the code. If your app class and 
your menu class, etc. are each creating their own extension of utils, 
then how are those subclasses communicating? Are they calling some 
update function in the super class?
It sounds like you need to use a singleton, and give it an update() 
method that any class can access. That way you know all your classes are 
updating the same instance.

Here are great examples of singletons:
http://www.gskinner.com/blog/archives/2006/07/as3_singletons.html

Hope that helps,
Bob


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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



  


--
Thanks,
~
Bob Leisle 
Headsprout Software  Engineering

http://www.headsprout.com
Where kids learn to read! 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] central up to date data

2007-10-20 Thread Stephen Downs
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] central up to date data

2007-10-20 Thread David Ngo
You may want to look into using a Singleton or static class, depending on
how you have things implemented and what the desired functionality is.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom Huynen
Sent: Friday, October 19, 2007 5:41 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] central up to date data

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] central up to date data

2007-10-19 Thread Tom Huynen
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders