Jump to content
GreenSock

charlesg99

Idle menu using That much cpu? [SOLVED]

Recommended Posts

Hi guys,

 

I designed a menu for a website using only tweenlite and timelinelite. When the menu is idle (no mouse over), It is completely inert and there is only some textfields inside of movieclips on it. To make everything invisible I'm using autoAlpha and when the menu is idle, everything is set to autoAlpha 0. In my menu there is only bitmaps, no vectors, no enterframes, everything except the actuals button is set to mouseEnabled=false and all my timelinelites are paused.

 

What I cant't figure out is that even on idle, the menu shows me a cpu usage of about 10... I mean there is nothing moving or rendering... I can understand when the animation is happening that the cpu usage goes up but inert like that? I don't think that the tweenlite or the timelinelite are the problem but do you have a general idea how to make inert textfield use less cpu ?? I just don't see what could be causing this... it's kind of frustrating to invest lots of time on something that finally has little problems that prevent it from being exactly like you want it to be...

 

Thanks a lot for your help,

Link to comment
Share on other sites

The tweening engine itself does consume a very small amount of memory/cpu resources even when things are paused, but it really shouldn't cause problems for you. When I first created the engine, I put logic in place to remove the ENTER_FRAME listener that drives the core timing, but there were two problems with that:

 

1) It actually added more cpu usage in all cases except when there were no tweens because the conditional logic had to run whenever a tween started/stopped, and execute more code when the listener had to be added or removed. It also added kb unnecessarily.

 

2) The new "useFrames" feature of v11 requires that the engine keep track of frames as they elapse (even if things are paused) in order to measure things accurately.

 

So the first time you tween, the engine starts and stays on, listening for ENTER_FRAME events. But again, this should be absolutely no big deal performance-wise or memory-wise.

 

I wouldn't expect cpu usage to go all the way down anyway, even without TweenLite. Flash itself eats up a certain amount on its own, tracking the mouse, firing off mouse movement/rollover/out events, etc. Is the CPU at 10% killing your performance or something? Why are you worried about it? (just curious)

Link to comment
Share on other sites

Thanks for your answer :)

 

It doesn't affect the performance at all in fact, I was just wondering why a static text would require cpu usage to render since nothing is happening. I also noticed that the percentage of used cpu is a lot higher in firefox compared to explorer... This is weird but it is probably browser related.

 

You make it sound like this is completely normal so that will stop my worries :) I was also looking for good general "practices" as well since after lots of research I can't find very consistent information about code writing for efficiency. Like setting mouseEnabled=false on everything that doesn't interact with the mouse sounds like a spread idea on the web, do you have any more advice of this kind?

 

Thanks again

Link to comment
Share on other sites

Is the text being anti-aliased, because that requires a decent amount of cpu to process?

Link to comment
Share on other sites

Yes it is antialiased for animation... If it's not this way the animation gets very choppy. Is it causing cpu usage even if it is iddle and nothing is happening?

 

I also have a class that is applied to all my "button" and it contains a timelinelite animating it. I just did some test and it seems that if I remove it from all of the button and I only have one changing position as the mouse goes, it seems to cause less cpu activity... I thought that having symbols being set to visible=false wouldn't affect the cpu usage but it seems that I was wrong.

Link to comment
Share on other sites

Ok just to maybee help people having similar issue... It seems that even if a movieclip that is being animated by a timeline running in loop is set to visible=false (with autoAlpha:0) it still drains cpu usage. I added some functions to my listeners that stopped the timelines when the menu is iddle and it completely removed the cpu usage.

 

Another thing that helped was to set a custom antialias (thickness:100 and sharpness:0) instead of antialias for animation. The only texts that needed to be alias for animation are set via as3 like this:

 

myText_txt.antiAliasType= "advanced";
myText_txt.gridFitType = "subpixel";

 

I'm pretty pleased whit the results! 0 cpu usage instead of 10

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×