||View All MessagesBack to WebFX|
From: Scott Barnes
Sent: April 25, 2004
Subject: Re:Q. onEnterFrame in DHTML?
I have a component made in DHTML which basically draws a 2 DIV bevel effect, kind of short cutting some graphic work.
Problem I have faced is how do you invalidate with dhtml? In ActionScript we could basically add a series of method calls to a que and then on the next frame/interval it basically processes that que.
The cool part about this technique is it can reduce method calls. An example of such would be say I generate a DoubleBevel Panel (ie 2 panels ontop of eachother). Now to build this I need to size each panel? so basically in my layoutChildren() method, I have two calls per Bevel (SetSize,moveTo). This is i guess ok, but sadly the setSize and moveTo each have a draw() call within their methods, resulting in the draw method for a SingleBevelPanel object being called twice?
Instead It would be great to be able to add the draw method to a que, and if another request for draw is requested, it then checks the que and if it already exists, basically continues on. This results in 1 draw call vs many. Of course if you wanted to request the draw method be called twice or more you can over-ride the que.
How do people out there do this style of technique with DHTML. The only way I can think of is using a SetInterval style approach? but is that a good idea?