Paul Steven wrote:
> Thanks Muzak
>
> I think the WeatherManager is a Singleton - well that’s what it said in the
> book:)
>
> import Observable;
> import WeatherMessage;
>
>
> class WeatherManager extends Observable {
>
>
> // -----------
> // Constructor
> // -----------
>
> private function WeatherManager() {
>
> weatherTimer = setInterval(mx.utils.Delegate.create(this,
> changeWeather), 5000);
>
> }
>
>
> public static function getWeather():WeatherManager {
>
>
> if (weather == null) {
> weather = new WeatherManager();
> }
> return weather;
> }
>
You may prefer a more common syntax for the singleton access method,
like getInstance for example.
Personally I would prefer an EventDispatcher rather than the Observer
pattern, creating events like onWindChange, onRainChange, etc..., and a
WeatherEvent object carrying the new weather values.
It'll be more flexible if you want to add more weather phenomenon at a
later time.
My two euro cents.
> Undocumented? Maybe you meant "documented"?
>
Thanks Muzak to rectify me, some memory holes...
Cédric
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com