Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8149893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:56:32+00:00 2026-06-06T14:56:32+00:00

Is there an example of a bitmap color replacement implementation that actually works? I’m

  • 0

Is there an example of a bitmap color replacement implementation that actually works?

I’m trying to achieve the following:

Before:

After:

Note: I’m not trying to use a color matrix transformation here. I want the ability to select 1 color, then select a threshold, and then select a new color which would effectively shift all the colors in the threshold.

Is this idea possible to execute very accurately? If so can you point me to a proof-of-concept?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:56:33+00:00Added an answer on June 6, 2026 at 2:56 pm

    Just to get the ball rolling on this… I don’t know that this is going to be the right solution for you but it’s a start.

    This answer shows how to use the BitmapData.threshold method to replace colors. You could replace a color with a transparent pixel, then put a background behind your MovieClip and animate between colors.

    var inputBitmapData:BitmapData = new BitmapData(200, 200, true, 0xFF0000FF);
    inputBitmapData.fillRect(new Rectangle(10, 10, 180, 180), 0xFFFF0000);
    
    var outputBitmapData:BitmapData = new BitmapData(200, 200, true); 
    var destPoint:Point = new Point(0, 0); var sourceRect:Rectangle = new Rectangle(0, 0, outputBitmapData.width, outputBitmapData.height); 
    var threshold:uint =  0xFFFF0000;  
    var color:uint = 0x00000000;     
    outputBitmapData.threshold(inputBitmapData, sourceRect, destPoint, "==", threshold, color, 0xFFFFFFFF, true);
    
    var input:Bitmap = new Bitmap(inputBitmapData); addChild(input);
    var output:Bitmap = new Bitmap(outputBitmapData); output.x = input.x + input.width + 10; 
    
    addChild(output);
    

    You could also loop through the bitmapdata pixel by pixel to replace one color with another.

    for (var j = 0; j < bitmap.height; j++) {
        for (var i = 0; i < bitmap.width; i++) {
            if(bitmapData.getPixel(i,j)==0xFFFF00)  {
                bitmapData.setPixel(i,j, 0xFF0000);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an example of an OAuth implementation or profile which uses multiple authorization
Is there any opensource library/WPF Control that can act as bitmap editor (e.g. just
is there any example on using java method to call rhino-javascript function and return
Is there any example on DOS Batch - Find and Replace command for files?
Is there any example for a Real Time Chart using the DexExpress in ASP.Net?
There is an example on Adobe livedocs for using states : <!-- Define one
There is an example (let us say in a file named mybatch.bat ): @echo
is there a good example of a source file containing Javadoc ? I can
Is there any code example teaching how to zoom in and out in a
On the Groovy example page there is an example of how to use Groovy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.