this is better to ensure you're not overriding an old handler and also to
delete it after its purpose is no longer needed
function fireEventOnFrame(frameNumber:Number){
//backup older enterframe handler
var oldEnterFrame=(this.onEnterFrame==undefined|this.onEnterFrame==null)?
this.onEnterFrame : null;
this.onEnterFrame = function(){
oldEnterFrame();
if(this._currentframe==frameNumber){
// broadcast onFrameReached
broadcaster.dispatch({type: "onFrameReached"});
//if there was no old enterframe handler delete this handler
if(oldEnterFrame==null)
{
delete this.onEnterFrame;
}
}
}
}
On 12/3/06, Yehia Shouman <[EMAIL PROTECTED]> wrote:
function fireEventOnFrame(frameNumber:Number){
//backup older enterframe handler
var oldEnterFrame=(
this.onEnterFrame==undefined|this.onEnterFrame==null)? this.onEnterFrame :
null;
this.onEnterFrame = function(){
oldEnterFrame();
if(this._currentframe==30){
// broadcast onFrameReached
broadcaster.dispatch({type: "onFrameReached"});
//if there was no old enterframe handler delete this handler
if(oldEnterFrame==null)
{
delete this.onEnterFrame;
}
}
}
}
On 12/2/06, Seb L <[EMAIL PROTECTED]> wrote:
>
> why can't you just use this on the first frame :
>
> this.onEnterFrame = function(){
>
> if(this._currentframe==30){
> // do something
> }
>
> }
>
>
> cheers!
>
> Seb Lee-Delisle
> www.sebleedelisle.com
>
> On 02/12/06, Ray Chuan <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > afaik there's no such thing.
> >
> > If you want to, in the frame that you are looking for you can put a
> > dispatch call, eg at frame 30:
> >
> > trace("frame reached");
> > broadcaster.dispatch({type: "onFrameReached"});
> >
> > I made that up, there's no event by the name onFrameReached.
> >
> > Even if you do that or use onEnterFrame you may not get what you want
> > since the player can choose to skip that frame/not call onEnterFrame
> > for performance reasons.
> >
> > On 12/1/06, Wendy Richardson < [EMAIL PROTECTED]> wrote:
> > > Hi All,
> > >
> > > I'm looking for some suggestions for the best way to know when a
> certain
> > > frame has been reached or plays.
> > >
> > > Barring checking for that frame-by-frame on each onEnterFrame, is
> there
> > > a way to listen for a swf reaching or playing a certain frame? Some
> > > event to listen for?
> > >
> > > Code will be 1st frame only or via new classes.
> > >
> > > Thanks for any ideas!
> > >
> > > Wendy
> > > _______________________________________________
> > > [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
> > >
> >
> >
> > --
> > Cheers,
> > Ray Chuan
> > _______________________________________________
> > [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
>
_______________________________________________
[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