Skip to main content
Known Participant
October 7, 2016
Question

Animate CC How can i cache as bitmap movie clip?

  • October 7, 2016
  • 1 reply
  • 1075 views

I have a movie clip (enemy) inside the enemy i have 3 frames for iddle, attack and run.The enemies are inside Array.What is the better way to cache as bitmap the enemy and movie clips inside the enemy?

var greengoblinVelocity: int = 0;

var e: int;
for (e = numChildren - 1; e >= 0; e--)
{
var childdE: DisplayObject = getChildAt(e);
if (childdE.name.indexOf("enemy") > -1)
{
  
GreenGoblinArray.push(MovieClip(childdE));
  
MovieClip(childdE).hitPoints = 2;
  
MovieClip(childdE).currentX = 0;
  
MovieClip(childdE).startAttack = 0;
}
}


stage
.addEventListener(Event.ENTER_FRAME, gameloop);
function gameloop(event: Event😞 void
{
for (var enl = 0; enl < GreenGoblinArray.length; enl++)
  
{
  
var enemy: Enemy = GreenGoblinArray[enl] as Enemy;
  
}
}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
October 8, 2016

it doesn't make any sense to cacheAsBitmap a movieclip that will be changing frames more than rarely.

create 3 movieclips of the 3 frames and cache each of them if there's enough memory and a significant performance benefit.