[Papervision3D] Single vs. multiple onEnterFrame

Anthony Tambrin copet80.mailinglist at gmail.com
Mon Apr 2 00:34:45 EDT 2007


I like your approach, Ryan. Having an update method on the interface, and
having all classes that implements that interface implement the update
method so the single event handler can call this object, sounds to me a neat
approach. I'm gonna try that for a game that I'm developing.

Peter, if you're reading this thread, since I notice you're doing an app
that shoots bullets, any thoughts on this matter?

Cheers,
Anthony


On 4/2/07, Ryan Taylor <rtaylor11 at gmail.com> wrote:
>
> If there is any noticable difference in performance, it will be very, very
> small. Even if having an enter frame event listener for each object did
> slightly out-perform the single event handler approach, I would still favor
> having a single handler.
>
> Imagine if you had twenty different types of objects that needed to be
> iterated through and updated each frame. In each different type, you would
> have to add an event listener for the enter frame event. If somebody else
> that wasn't familiar with your code came alone and wanted to add a
> twenty-first type of object to the mix, they would have to know to add an
> event listener for the enter frame event as well. On the other hand, if you
> have the single event handler and an interface that all the objects adhere
> to, you can mandate that each object has an 'Update' method and then simply
> write one handler for the enter frame event that iterates through a
> collection of your objects and calls the 'Update' method for each one.
>
> I hope that makes sense. Really what it all comes down to is cleaness and
> flexibility. Either way, a collection of objects is going to get iterated
> though; either it will be in the event dispatcher or your single enter frame
> handler.
>
> Ryan Taylor
> http://www.boostworthy.com
>
>
> On 4/1/07, Anthony Tambrin <copet80.mailinglist at gmail.com> wrote:
> >
> > I see :) John, basically you're saying centralized onEnterFrame is good
> > for processing that don't depend on scopes, which is quite the case given
> > one's preference of coding in AS3. Felix, I'd be interested to see some
> > concrete data on those difference, even if it's really small. I'm thinking
> > of doing some benchmarking little app for this purpose and post the app on
> > the forum, hopefully by end of this week.
> >
> > Cheers,
> > Anthony
> >
> >
> > On 4/2/07, John Grden <neoriley at gmail.com> wrote:
> > >
> > > when the playhead changes frames, all registered onEnterEvent
> > > listeners are fired.  I think the reasoning for individual EnterFrames would
> > > be based on scope and control of the object itself, but if it's something
> > > that has to happen at the same time and scope isn't an issue etc, might as
> > > well put it in one method.
> > >
> > > my 2cents based on what I think you were asking ;)  (that's my
> > > disclaimer)
> > >
> > >  On 4/1/07, Anthony Tambrin < copet80.mailinglist at gmail.com > wrote:
> > >
> > > > Hi all,
> > > >
> > > > This is more of a general flash question. But I reckon it's the
> > > > heart and soul of pv3d applications :)
> > > >
> > > > Question is:
> > > >
> > > > Which one is more efficient?
> > > > A. All processing is centralized in the main Sprite ENTER_FRAME
> > > > event handler, i.e. run()
> > > > B. Objects have their own ENTER_FRAME event handler
> > > >
> > > > Which one will run more efficiently, and thus, faster?
> > > >
> > > > Cheers,
> > > > Anthony
> > > >
> > > > _______________________________________________
> > > > Papervision3D mailing list
> > > > Papervision3D at osflash.org
> > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > >
> > > >
> > >
> > >
> > > --
> > > [  JPG  ]
> > > _______________________________________________
> > > Papervision3D mailing list
> > > Papervision3D at osflash.org
> > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > >
> > >
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070402/1d927746/attachment-0001.htm


More information about the Papervision3D mailing list