--- In flexcoders@yahoogroups.com, "Matt Chotin" <[EMAIL PROTECTED]> wrote:
>
> ENTER_FRAME is prior to every frame.  RENDER is only when the components
> ended up invalidating and requiring a draw.
>

Unfortunately, it appears that invalidation does NOT merely force a
RENDER of the invalidated component (and those which it overlaps); it
forces a RENDER (and it seems a redraw) of EVERY component in the
application!!

So, if for example, you want to move perform any kind of animation
using an ENTER_FRAME (or timer) eventListener, you will force a redraw
of the entire screen, no matter how tiny the animation area is.
Furthermore, if you put a textArea in that triggers on ENTER_FRAME
that calculates the frame rate, you will also get a RENDER every frame
to every component in your App (which may be what the OP was
experiencing).

The Sample code (below) illustrates this. Clicking on a button (which
has no "click") which is contained within one canvas causes four
RENDER events to be received by the label (or apparently, any UI
component), even though it is in a different, non-overlapping
container). As far as I can tell, the RENDER event also corresponds to
a redraw (at least that's what my testing seems to indicate).

Making the text label invisible does not stop it from getting the
RENDER event. Nor does making the containing canvas invisible; so one
must imagine that the RENDER event is passed down the chain in any
case. Nor does setting the "mask" for the respective containing
canvasses; a RENDER event is always generated if any invalidation occurs.

This has some real adverse performance effects: doing
any on-screen animations or debugging (such as a frame rate counter)
causes the system to redraw - which, if you have a large page of text
which is not cacheAsBitmap, requires an entire chain of re-rendering
to occur. I get frame rates of around 10-15 fps on a 3.0GHz machine
with a display area of 1366 x 768 for "static" pages of text, unless
they are set as "cacheAsBitmap"; in which case I get something like
20, not anywhere near 30. :(

Any thoughts on how to work this out? I haven't looked at the source
code yet to figure out why this is happening (just installed beta3).
The RENDER event is not cancellable, so I can't figure out how to
convince a container to not redraw itself, when I know for a fact that
it's not neccessary.

Cheers - Chas

----------- Sample Code ----------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">

.       <mx:Script>
.               <![CDATA[
.               public function catchRender(event:Event):void {
.                       trace("render event: "+event)
.               }
.               ]]>
.       </mx:Script>

.       <mx:Canvas x="26" y="31" width="365" height="62">
.              <mx:Label id="aUI" x="10" y="10"
.                      text="This is just a label"
.                      width="272"
.              creationComplete="aUI.addEventListener(Event.RENDER,
this.catchRender)"/>

.       </mx:Canvas>

.       <mx:Canvas x="26" y="125" width="365" height="79">
.               <mx:Button x="10" y="10" label="Button"/>
.       </mx:Canvas>
.</mx:Application>
--------------------------------------------------------


> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of loftling
> Sent: Wednesday, April 12, 2006 1:22 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] RENDER event: before every frame or only when
> certain UI elements change?
>
> Does anyone know if the RENDER event (flex 2 / actionscript 3.0,
> flash.events.Event.RENDER) is supposed to be dispatched to the display
> list prior to every frame, or is it merely supposed to be dispatched
> prior to a frame in when *certain* UI elements (like mx controls) have
> their state updated. The documentation led me to believe the former, but
> in reality the latter is happening, which seems less useful to me.
>
> (<a
> href="" href="http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?">http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?
> \
> catid=587&threadid=1141438">Posted on the Adobe labs forums</a>, amongst
> the tumbleweeds.)
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to