i tried duplicating a movie clip of a bar with animation that tweens upwards and changes colors from red to green when it reaches it’s last keyframe.
however, duplicating the movieclip only duplicates the first frame of the movieclip and not the rest of the animation.
so i’m looking for a way to dynamically change the color of the movieclip based on it’s _y position instead, however i don’t know how to dynamically change the color from red to green using only actionscript.
here’s the code i used
stop();
this.onEnterFrame = function(){
/* creates bars */
for(counter=0;counter<=10;counter++){
duplicateMovieClip (_root.bar, "bar" + counter, counter);
}
/* this places the bars in their places */
for (counter=0;counter<=10;counter++){
this["bar"+counter]._x = 42+this["bar"+(counter-1)]._x ;
this["bar"+counter]._y = this.bar._y;
}
colorshift = new Color("_root.bar");
colorshift.setRGB(0x006699);
}
i also would like to know how to preserve the image gradient within the movieclip
or is there a way to just change the percentage of the RGB (like in properties>color>advanced option) because my current code changes it into a single color and makes the image look flat.