Hi,
Well I'm having a hell of a time trying to get my CPU down under 45% when running my current application. I've tried all sorts of optimization tricks and tips with little success and I'm at a point now where I need a fundamentally different approach.
Problem and Current Approach
In the main view of my application I have a single enterframe handler. I have my frame rate down as low as 10 fps. This handler notifies 16 seperate movie clips to draw wedges of varying angles using Lee Brimelow's wedge class.
So, 16 times every enterframe, I have 16 movieclip graphic clear, begin fill, draw wedge, endfill all being co-ordinated by my single enterframe handler.
Doing this is bumping my cpu up to between 40-50% :o
Possible Alternative?
I had one idea of just having a movie clip that was 360 frames long and revealing segments of a circle using a mask but I'm not an animator and have no idea how to make such a mask.
Question
So, I guess my method just isn't going to cut it. Can anybody suggest a better method for trying to accomplish my goal?
I don't see how drawing 16 wedges per frame = such a high cpu, so I must be doing something fundamentally wrong.
Any ideas?
MAIN EVENT FUNCTION
private function updatePadProgress(e:Event):void
{
viewStackContainer.remixscreen.padUIManager.updatePadArcs2(this.model.audioEngine._channels)
}
Looping through all circles Passing values
public function updatePadArcs2(channels:Vector.<Channel>):void
{
var pc:PadContainer;
var input:Input
var c:int=0;
var p:int=0;
var pct:Number;
var cc:Channel
var position:int=0
var len:int=0
for (var i:int=0; i < pads.length; ++i)
{
pc=pads[i];
c=pc.channelassign;
p=pc.padassign;
input=channels[c].inputs[p];
if (input.currentState == Input.ACTIVE)
{
position=input.inputAudio.samples.position
len=input.inputAudio.samples.length
pct= position/len
pc.drawProgress(pct)
}
}
}
The Drawing Function
public function drawProgress(pct:Number):void
{
pad.drawOn.graphics.clear()
pad.drawOn.graphics.beginFill(0x000000)
Wedge.draw(pad.drawOn,0,0,10,360,0)
pad.drawOn.graphics.endFill()
}