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..
The movieclip is called Plane_Level but i had linked it to actionscript as a class nameed PlaneLevel
im not sure if that makes a difference but when iadded that declaration
the line :
private var PLevel:PlaneLevel = new PlaneLevel();
now gives an error
| 1046: Type was not found or was not a compile-time constant: PlaneLevel. |
| 1180: Call to a possibly undefined method PlaneLevel. |
yes, i used the exact line you gave. the above errors are what came up
and yes the class file extends movieclip for PlaneLevel
I'm trying to cache as bitmap before those movieclips are added to the stage though. is that possible? should I add the loading screen to stage then load all movieclips under that and then execute the cache as bitmap commands?
North America
Europe, Middle East and Africa
Asia Pacific