Guest User

Untitled

a guest
Feb 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public function swapColor(colorToSwap:uint,newColor:uint):void{
  2. if(this._palette.indexOf(newColor) != -1){return;}
  3. for(var x:int=0;x<this._source.width;x++){
  4. for(var y:int=0;y<this._source.height;y++){
  5. if(this._source.getPixel(x,y) == colorToSwap){
  6. this._source.setPixel(x,y,newColor);
  7. var index:int = this._palette.indexOf(colorToSwap);
  8. if(index != -1){
  9. this._palette[index] = newColor;
  10. }
  11. }
  12. }
  13. }
  14. this.updateBuffer();
  15. }
Add Comment
Please, Sign In to add comment