correct way to implement cache as bitmap to deeply nested movieclips? help!
I've been really stuck at this problem for a number of days and cant find any help online as to where im going wrong.
1119: Access of possibly undefined property CloudsNAnim through a reference with static type Class. |
the setup as of now, there are 4 movieclips i want to cacheasbitmap. two copies of a vector movieclip called CloudS2 and two copies of one called CloudS4
those are in a movieclip holding them called CloudsNear and another movieclip holding that which holds an animation of the CloudsNear movieclip moving past the screen in a loop which is called CloudsNAnim
and that is inside the main level which is added to the stage called PlaneLevel
where do i place the cacheasbitmap lines in my code to load them into memory before I load the main movieclips
package
{
// all my imports etc //
public class MightyMend extends MovieClip
{
public function MightyMend()
{
// constructor code
addChild(PLoading); //this loads my loading screen png to the stage
stage.addEventListener(Event.ENTER_FRAME, loading); //reoccuring event listener happens as often as is set by FPS
PlaneLevel.CloudsNAnim.CloudsNear.CloudS2.cacheAsBitmap = true;
PlaneLevel.CloudsNAnim.CloudsNear.CloudS4.cacheAsBitmap = true; //these lines dont work
}
private var PLoading:Bitmap = new Bitmap (new PlaneLoading());
private var PLevel:PlaneLevel = new PlaneLevel();
public function loading(e:Event):void //
{
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
var percent:Number = loaded/total * 100;
trace (percent);
if (total == loaded) //checks if all bytes for all movieclips have been loaded
{
stage.removeEventListener(Event.ENTER_FRAME, loading);
onComplete();
}
//the rest of the code staes that when oncomplete it will remove the loading screen and add the plevel to the stage etc..
