Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
CPU Usage

CPU Usage

2004-02-13       - By Adrian MacTaggart

 Back
Reply:     1     2     3     4  

I have a Flash movie and when running it the CPU usage is up to around
100%. On the first frame of my movie (root) I have a script that calls
an external .as file (this file holds variable data). It then puts this
data into arrays. As follows:

__ ____ ____ ____ ____ ______
#include "trumps_data.as "

pack = [];
pack.total = 14;
pack.title = "which ship is the best? ";
pack.desc = "pack description test ";
pack.catA = "Size ";
pack.catB = "Strength ";
pack.catC = "Speed ";
pack.catD = "Fighting ";
pack[ 'cards '] = [];
for(i=1; i <=pack.total; i++){
   pack[ 'cards '][i] = [];
   pack[ 'cards '][i][ 'ID '] = i;
   pack[ 'cards '][i][ 'title '] = this[ "title "+i];
   pack[ 'cards '][i][ 'desc '] = this[ "desc "+i];
   pack[ 'cards '][i][ 'catAScore '] = this[ "scoreA "+i];
   pack[ 'cards '][i][ 'catBScore '] =   this[ "scoreB "+i];
   pack[ 'cards '][i][ 'catCScore '] = this[ "scoreC "+i];
   pack[ 'cards '][i][ 'catDScore '] = this[ "scoreD "+i];
}

More code down here...to shuffle cards...to deal cards...etc
__ ____ ____ ____ ____ ______

There is a 'playing card ' movie clip and after it is dealt and turned
over (tweened over frames) it stops on the last frame, the dynamic text
boxes (on the face of the card) are populated with the correct data.
This is done using the following script on the last frame of the
'playing card ' mc:
__ ____ ____ ____ ____ ______
root.pcc = _root.hand1[0];
cardTitle.text=_root.pack[ 'cards '][_root.pcc][ 'title '];
cardDesc.text=_root.pack[ 'cards '][_root.pcc][ 'desc '];
catAButton.catATitle.text=_root.pack.catA;
catBButton.catBTitle.text=_root.pack.catB;
catCButton.catCTitle.text=_root.pack.catC;
catDButton.catDTitle.text=_root.pack.catD;
catAScore.text=_root.pack[ 'cards '][_root.pcc][ 'catAScore '];
catBScore.text=_root.pack[ 'cards '][_root.pcc][ 'catBScore '];
catCScore.text=_root.pack[ 'cards '][_root.pcc][ 'catCScore '];
catDScore.text=_root.pack[ 'cards '][_root.pcc][ 'catDScore '];
playerImageHolder.loadMovie( "shark.jpg ");
playerImageHolder._y = 0;
stop();
__ ____ ____ ____ ____ ______
This 'playing card ' script seems to be causing problems with the CPU as
if I comment it out and the card is not populated with data the Flash
Player is not taking up the CPU usage.

If anyone has any ideas on why this code would cause the CPU usage to
jump right up, it would be much appreciated as at the moment the movie
is unlikely to function well on slower machines!

Many thanks,

Adrian


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104147
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)