Manish Jethani [EMAIL PROTECTED] said:
>Try avoiding the call to getNextHighestDepth() by maintaining
>your own counter.
I want to know why I should avoid using getNextHighestDepth(). This is
partially awnsered by:
JesterXL [EMAIL PROTECTED]
>getNextHighestDepth is, from experience, overrwritten from the
>Flash implementation, and handles depth management in ActionScript
>rather than letting the player do it; this allows depth to work in
>the framework. The problem is, this slows getNextHighestDepth
>considerably since it's now written in ActionScript instead of native
C.
Is this true?
And if its actionscript, my guess is the performance of this mechanism
cant be an issue. I imagine the functionality works something like this:
var _highestDepth_num = 0;
function attachMovie(linkageID_str, newName_str, depth_num)
{
_highestDepth_num = _highestDepth_num < depth_num ? depth_num :
_highestDepth_num;
originalAttachMovie(linkageID_str, newName_str, depth_num);
};
function createEmptyMovieClip(newName_str, depth_num)
{
_highestDepth_num = _highestDepth_num < depth_num ? depth_num :
_highestDepth_num;
originalCreateEmptyMovieClip(newName_str, depth_num);
};
//etc, u get the point
function getNextHighestDepth()
{
return (_highestDepth_num + 1)
};
How can this be a performance hit?
Greetz Erik
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of JesterXL
Sent: maandag 25 april 2005 15:48
To: [email protected]
Subject: Re: [flexcoders] Re: createClassObject
If you are just controlling visibility, use setVisible(false/true)
instead of creating the objects each time; that should be significantly
more efficient.
Secondly, yeah, z order is a good concept. Basically, each element in
Flash is drawn on a depth. Higher depths are where things are drawn
closer to you, and lower depths are where things are drawn farther away,
and below those are higher depths. Only 1 element can occupy a given
depth at any given time, and if something is created in an occupied
depth, it destroys whatever object is there, and then creates itself.
getNextHighestDepth is, from experience, overrwritten from the Flash
implementation, and handles depth management in ActionScript rather than
letting the player do it; this allows depth to work in the framework.
The problem is, this slows getNextHighestDepth considerably since it's
now written in ActionScript instead of native C. Therefore, set a
private var depth:Number up top in your class, set it to -1 in your init
function, and then do:
createClassObject(Control, "name", ++depth);
That way, it'll auto-increment.
...you don't have to do with any of this if you extend mx.core.View
instead of UIComponent for your cell renderers.
----- Original Message -----
From: "viraf_bankwalla" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, April 25, 2005 9:37 AM
Subject: [flexcoders] Re: createClassObject
I have two images and three labels in each cell. Their visibility
is controlled by the data and user display criteria - thus I specify
a name for them.
I noticed that if I did not specify getNextHighestDepth() it
appeared that each time createClassObject was called the prior
object was destroyed and the new one created.
Could someone please provide me an explanation on what
getNextHighestDepth does. My understanding was that this was the z-
order, thus could I just set all the children to be at the same z-
order ? If not, is a simple one up counter sufficent ?
Thanks.
--- In [email protected], Gordon Smith <[EMAIL PROTECTED]> wrote:
> If only a single Image named "imgE" is being created per cell,
then you
> don't have to specify a unique name -- only children of a single
parent have
> to have unique names. However, there is generally no good reason
to ever
> specify a name in createClassObject. If you pass undefined for the
second
> argument, Flex will generate a unique name for you.
>
> - Gordon
>
> -----Original Message-----
> From: [email protected]
[mailto:[EMAIL PROTECTED]
> Sent: Sunday, April 24, 2005 11:26 AM
> To: [email protected]
> Subject: [flexcoders] Re: createClassObject
>
>
>
>
> --- In [email protected], "viraf_bankwalla"
> <[EMAIL PROTECTED]> wrote:
>
> > imgE = createClassObject(Image,"imgE", getNextHighestDepth());
>
> Try avoiding the call to getNextHighestDepth() by maintaining your
own
> counter.
>
> Also, I think the second argument to createClassObject() needs to
be
> unique.
>
>
>
>
>
>
> Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/