Adobe Dreamweaver Forums



Last 10 THreads :         Re: Photoshop CS4 is a disaster (Last Post : Paulo_Skylar@adobeforums.com - Replies : 0 - Views : 1 )           »          Query question/help (Last Post : trojnfn - Replies : 2 - Views : 3 )           »          CS4 Motion Editor issues (Last Post : aaronlyon - Replies : 4 - Views : 9 )           »          Bridge No Longer Rotates Automatically (Last Post : Michael_Palumbo@adobeforums.com - Replies : 1 - Views : 2 )           »          dollarFormat / numberformat problem (Last Post : izdabye - Replies : 0 - Views : 1 )           »          Call out side flex (Last Post : Amy Blankenship - Replies : 15 - Views : 16 )           »          captions for photos (Last Post : dc111652 - Replies : 0 - Views : 1 )           »          Re: CS4 GPU Acceleration and Intel X3100 (Last Post : Paul_B_Brown@adobeforums.com - Replies : 0 - Views : 1 )           »          error 1034 (Last Post : shottogan - Replies : 0 - Views : 1 )           »          Keyboard events don't work in player or projector (Last Post : tunghoy - Replies : 0 - Views : 1 )           »         


User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-03-2008, 04:38 AM
matthewlee
 
Posts: n/a
Diggs:
Default Capturing Render Times

:cool;

I'm trying to measure the time it takes to render things like circles,
rectangles, text, images, ect. Here is a snippet of code that creates random
circles and adds them to a UIComponent.

var result:UIComponent = new UIComponent();
addChild(result);
// render time
var rdiff:Number = new Number();
// execution time
var ediff:Number = new Number();
var circle:Sprite = new Sprite();
// counter
var i:int = 0;
// time place holders
var before:Number = new Number();
var after:Number = new Number();

while(i < rows) {
// Create x many random circles
before = new Date().time;
circle.graphics.beginFill(Math.random() * 0xFFFFFF,1);
var rnd:int = Math.round(Math.random() * (300)) + 0;
var rnd2:int = Math.round(Math.random() * (300)) + 0;
circle.graphics.drawCircle(rnd,rnd2,50);
circle.graphics.endFill();
after = new Date().time;
ediff += (after - before);
// Display x many circles
before = new Date().time;
result.addChild(circle);
after = new Date().time;
rdiff = rdiff + (after - before);
i = i + 1;

}

Would this be the correct way of measuring the render time? Am i way off or
silly?



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-03-2008, 04:38 AM
matthewlee
 
Posts: n/a
Diggs:
Default Re: Capturing Render Times

So I have been measuring the render time as the time it takes to go through
addChild(). Here is what I found about how addChild() works. Which of these
would or would not be related to the render time?

1. Container.addChild(b);

Flex performs the following actions:

a. Sets the parent property for the component to reference its parent
container.

b. Computes the style settings for the component.

c. Dispatches the preinitialize event on the component.

d. Calls the component?s createChildren() method.

e. Calls the invalidateProperties(), invalidateSize(), and
invalidateDisplayList() methods to trigger later calls to the
commitProperties(), measure(), or updateDisplayList() methods during the
next render event.

The only exception to this rule is that Flex does not call the measure()
method when the user sets the height and width of the component.

f. Dispatches the initialize event on the component. At this time, all of
the component?s children are initialized, but the component was not sized
or processed for layout. You can use this event to perform additional
processing of the component before it is laid out.

g. Dispatches the childAdd event on the parent container.

h. Dispatches the initialize event on the parent container.

2. During the next render event, Flex performs the following actions:

a. Calls the component?s commitProperties() method.

b. Calls the component?s measure() method.

c. Calls the component?s layoutChrome() method.

d. Calls the component?s updateDisplayList() method.

e. Dispatches the updateComplete event on the component.

3. Flex dispatches additional render events if the commitProperties(),
measure(), or updateDisplayList() methods call the invalidateProperties(),
invalidateSize(), or invalidateDisplayList() methods.

4. After the last render event occurs, Flex performs the following actions:

a. Makes the component visible by setting the visible property to true.

b. Dispatches the creationComplete event on the component. The component
is sized and processed for layout. This event is only dispatched once when
the component is created.

c. Dispatches the updateComplete event on the component. Flex dispatches
additional updateComplete events whenever the layout, position, size, or
other visual characteristic of the component changes and the component is
updated for display.

Most of the work for configuring a component occurs when you add the
component to a container by using the addChild() method. That is because
until you add the component to a container, Flex cannot determine its
size, set inheriting style properties, or draw it on the screen.


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 03:46 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk