I'm looking to optimise the performance of my program.
Off the bat I've set stage quality to medium (if I set it to Low half my movieclips don't render). This helped, but I want more!!!
A hint I've read in the P3D Essentials book is to turn of animated materials when not needed. Fantastic idea, but doesn't explain how.
When I create a material I can set material.animated = false
and that works, but in another function I cannot access the material of my primitives. Something as simple as plane.material.animated = false
returns a null exception. So how do I turn on/off animated materials dynamically on my primitives?
Looking through the API this appears to be impossible. What I can do to improve performance, though, is remove the objects that are not visible, e.g. if a plane is completely hidden behind another plane, then don't show (render) it. This is what I was attempting to achieve with my original question...
I have all my planes held in an array.
//make all the planes invisible. Don't want to render them
for(var i = 0; i< planes.length(); i++)
{
planes[i].visible = false;
}
//show the first plane so we have **something** to see
planes[0].visible = true;
This works for me because I know that only one plane will be visible at a time (until it transitions to the next plane, in which case I make that plane visible, and when the current plane has finished transitioning, I hide that).