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 144939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:20:05+00:00 2026-05-11T08:20:05+00:00

I am trying to write something in my Flex 3 application with actionscript that

  • 0

I am trying to write something in my Flex 3 application with actionscript that will take an image and when a user clicks a button, it will strip out all the white(ish) pixels and convert them to transparent, I say white(ish) because I have tried exactly white, but I get a lot of artifacts around the edges. I have gotten somewhat close using the following code:

targetBitmapData.threshold(sourceBitmapData, sourceBitmapData.rect, new Point(0,0), '>=', 0xFFf7f0f2, 0x00FFFFFF, 0xFFFFFFFF, true); 

However, it also makes red or yellows disappear. Why is it doing this? I’m not exactly sure how to make this work. Is there another function that is better suited for my needs?

  • 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. 2026-05-11T08:20:06+00:00Added an answer on May 11, 2026 at 8:20 am

    A friend and I were trying to do this a while back for a project, and found writing an inline method that does this in ActionScript to be incredibly slow. You have to scan each pixel and do a computation against it, but doing it with PixelBender proved to be lightning fast (if you can use Flash 10, otherwise your stuck with slow AS).

    The pixel bender code looks like:

    input image4 src; output float4 dst;  // How close of a match you want parameter float threshold <   minValue:     0.0;   maxValue:     1.0;   defaultValue: 0.4; >;  // Color you are matching against. parameter float3 color <   defaultValue: float3(1.0, 1.0, 1.0); >;  void evaluatePixel() {   float4 current = sampleNearest(src, outCoord());   dst = float4((distance(current.rgb, color) < threshold) ? 0.0 : current); } 

    If you need to do it in AS you can use something like:

    function threshold(source:BitmapData, dest:BitmapData, color:uint, threshold:Number) {   dest.lock();    var x:uint, y:uint;   for (y = 0; y < source.height; y++) {     for (x = 0; x < source.width; x++) {       var c1:uint = source.getPixel(x, y);       var c2:uint = color;       var rx:uint = Math.abs(((c1 & 0xff0000) >> 16) - ((c2 & 0xff0000) >> 16));       var gx:uint = Math.abs(((c1 & 0xff00) >> 8) - ((c2 & 0xff00) >> 8));       var bx:uint = Math.abs((c1 & 0xff) - (c2 & 0xff));        var dist = Math.sqrt(rx*rx + gx*gx + bx*bx);        if (dist <= threshold)         dest.setPixel(x, y, 0x00ffffff);       else         dest.setPixel(x, y, c1);     }   }   dest.unlock(); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Try setting the tabIndex to an empty property: DOM.setElementAttribute(cdrMeseTabPanel.getElement(), 'tabIndex',… May 11, 2026 at 12:51 pm
  • added an answer Since I can't see your source code it is quite… May 11, 2026 at 12:51 pm
  • added an answer I would recommend calculating the Levenshtein distance and then simply… May 11, 2026 at 12:51 pm

Related Questions

I am trying to write my first real python function that does something real.
I am trying to write a unit test for an action method which calls
I am trying to write a servlet that will send a XML file (xml
I am trying to write a regular expression to strip all HTML with the
I am trying to write a Windows Form and ASP.NET C# front-end and MSAccess
I am trying to write a Factory Pattern to create either a MainMode or
I'm trying to insert a column into an existing DataSet using C#. As an
I am just trying to write a small web page that can parse some

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.