actionscript 3 - Change colors in a complex animation made of bitmaps/group -


i have animation of fireball. have choice of either using bitmaps (preferable since makes swf run little smoother) or using large group of objects (10-20 different drawings). made using deco tool , looks awesome!

anyhow, it's quite annoying make new one. plus when tried make new 1 didn't quite first one. i'm planning on making several different colors of fireballs. extremely nice if somehow filter colors of entire symbol fireball1, i'm struggling so.

i tried following code, whatever reason, made fireballs disappear completely. may getting confused because i'm adding these new childs of fireball1 class arrays. also, here link picture of timeline, think might understand fireball looks http://tinypic.com/view.php?pic=fd7oyh&s=5.

private var fireball1:fireball1; private var gametimer:timer; private var army1:array; //included arrays in case effects somehow private var colorfilter:colormatrixfilter = new colormatrixfilter(colormatrix); private var colormatrix:array = new array(         [[0, 0, 1, 0, 0],          [0, 1, 0, 0, 0],          [1, 0, 0, 0, 0],         [0, 0, 0, 1, 0]]);  public function playscreen(){     army1 = new array();     var newfireball1 = new fireball1( -100, 0 );     army1.push(newfireball1);     addchild(newfireball1);      gametimer = new timer(50);     gametimer.start();     addeventlistener(timerevent.timer, ontick) }  public function ontick():void {     var newfireball1:fireball1 = new fireball1( randomx, -15 ); newfireball1.filters = [colorfilter];     army1.push( newfireball1 ); addchild( newfireball1 ); } 

you need define matrix array before instantiate colormatrixfilter object. also, colormatrixfilter expects 1 dimensional array. see documentation recommends syntax using concat seems trick.

try updating code following:

// matrix should 1 dimensional array var colormatrix:array = new array(); colormatrix = colormatrix.concat([0, 0, 1, 0, 0]),  colormatrix = colormatrix.concat([0, 1, 0, 0, 0]),  colormatrix = colormatrix.concat([1, 0, 0, 0, 0]), colormatrix = colormatrix.concat([0, 0, 0, 1, 0]);  // matrix needs defined before it's added colormatrixfilter var colorfilter:colormatrixfilter = new colormatrixfilter(colormatrix); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -