Not shure if I got your problem right, but if you are using an object where
the function exists which you want to
execute with your interval, the syntax should be something like :
intervalId = setInterval(this, "sendMessage", intervalSpeed);
where "this" is a reference to the object where the method ("sendMessage")
you are calling is located.
"intervalSpeed" should be a number.
When Braodcasting the message, the first parameter is the name of the method
you want to get called, and the second (and following) parameters are
optional parameters to be passed on to the executing method.
/Eskil
----- Original Message -----
From: "Meinte van't Kruis" <[EMAIL PROTECTED]>
To: <Flashcoders@chattyfig.figleaf.com>
Sent: Monday, December 12, 2005 10:56 PM
Subject: [Flashcoders] Asbroadcaster and setinterval
Hello,
I'm trying something that might be obvious, but somehow isn't. What I'm
trying to do is broadcasting a message on a setinterval basis.
I've set up my events broadcaster class and it worked quite well.
The problem i had with it was that it extended MovieClip.. The only reason
for this was the onEnterFrame function, seemed a waste.
I came up with this to replace the onEnterframe and subsequently have the
eventbroadcaster class extend Object instead of MovieClip:
this.intervalID=setInterval(this.fireInterval,interval); <---- in the class'
constructor
function fireInterval(){
//_root.log.log(this._listeners);
this.broadcastMessage("onInterval",this.event);
}
Now, i've traced within the fireInterval function, and it works fine.
Problem is, the listeners never get the onInterval event broadcasted to
them.
When i do this(it also listens to key events):
function keyDown(){
this.broadcastMessage("onInterval",this.event);
}
it DOES work... So i'm quite stumped here,
first of all the fireInterval function gets executed, but the listeners
never hear it and
secondly, when I have a key event broadcast the event, the listeners DO hear
it...
What's the problem here? Don't AsBroadcaster and setInterval like each
other?
thanks,
Meinte
_______________________________________________
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