Thanks Muzak
I think the WeatherManager is a Singleton - well thats 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;
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: 05 November 2006 13:03
To: Flashcoders mailing list
Subject: Re: [Flashcoders] OOP advice for game
Undocumented? Maybe you meant "documented"?
http://livedocs.macromedia.com/flash/8/main/00001766.html
<quote>
setInterval function
setInterval(functionReference:Function, interval:Number, [param1:Object,
param2, ..., paramN]) : Number
setInterval(objectReference:Object, methodName:String, interval:Number,
[param1:Object, param2, ..., paramN]) : Number
</quote>
And further down on that page there's a complete example.
And the weatherInterval property should be private.
There is no problem whatsoever with private properties and setInterval.
I use them all the time.
You should consider making the WeatherManager class a Singleton as well.
regards,
Muzak
----- Original Message -----
From: "Cédric Néhémie" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Sunday, November 05, 2006 12:46 PM
Subject: Re: [Flashcoders] OOP advice for game
> Hi Paul,
>
> To resolve the setInterval scope issue you could use the second
> setInterval syntax (undocumented in the Flash doc) :
>
> weatherTimer = setInterval(this, "changeWeather", 5000);
>
>
> About the 80s time limit, if you target your swf to version 8, you could
use the setTimeout method witch is perfect for that ;)
> (work the same as setInterval).
>
>
> Cdric
>
> Paul Steven wrote:
>> Thanks James, sounds good enough to me and seems to work nicely.
>>
>> Many thanks
>>
>> Paul
_______________________________________________
[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
_______________________________________________
[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