oh wait the Delegate, now I get it, I never usually use setInterval, but I
figure it probably works within a different scope than the object calling
it.

On 12/13/05, Meinte van't Kruis <[EMAIL PROTECTED]> wrote:
>
> allright, thx for the help. The delegate thing might help, allthough I'm
> not sure the problem was ever with the interval thingy.
>
> Eskil, I'll look into your code, it does seem to do what I'm trying to
> implement.
>
> On 12/13/05, Jim Tann < [EMAIL PROTECTED]> wrote:
> >
> > Is is because your this statement no longer referes to the original
> > class. Try to use
> >
> > intervalId = setInterval(mx.utils.Delegate.create(this, fireInterval),
> > intervalSpeed);
> >
> > that should work.
> >
> > Jim
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] ] On Behalf Of Meinte
> > van't Kruis
> > Sent: 13 December 2005 09:19
> > To: Flashcoders mailing list
> > Subject: Re: [Flashcoders] Asbroadcaster and setinterval
> >
> > both are correct, that isn't the problem.
> >
> > the interval get's called properly
> >
> > function fireInterval(){
> >         trace("A");
> >          this.broadcastMessage("onInterval",this.event);
> > }
> > ^^ this traces "A" infinitely
> >
> > But the message never gets broadcasted, so it enters the function, but
> > it
> > doesn't broadcast the onInterval event.
> >
> > Then I checked if it was any problem with the whole AsBroadcaster thing
> > not
> > set up correctly, so I fired the event on a keydown event:
> >
> > function keyDown(){
> >            this.broadcastMessage("onInterval",this.event);
> > }
> >
> > this DOES broadcast the onInterval event..
> >
> > so the interval function get's fired, but doesn't fire the onInterval
> > event
> > for some mystical reason...
> > whereas another event(Key event in this case) CAN fire the onInterval
> > event
> >
> > I'm quite stuck on it actually :/
> >
> > On 12/13/05, eskil janson < [EMAIL PROTECTED]> wrote:
> > >
> > > 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
> > >
> > _______________________________________________
> > 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

Reply via email to