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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:35:37+00:00 2026-05-19T01:35:37+00:00

I need to be able to detect a fill area for something similar to

  • 0

I need to be able to detect a fill area for something similar to a coloring book picture. The user will click inside the area that needs to be filled. The image is user created bitmap content and so the fill area must be detected at runtime.

<fx:Script>
    <![CDATA[
        protected function myImage_clickHandler(event:MouseEvent):void
        {
            myImage.imageDisplay.bitmapData.floodFill(event.localX,event.localY,0xFFFFFF);
        }
    ]]>
</fx:Script>

<s:Image id="myImage" click="myImage_clickHandler(event)" source="/images/square.gif"/>
  • 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-05-19T01:35:37+00:00Added an answer on May 19, 2026 at 1:35 am

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html?filter_coldfusion=9&filter_flex=3&filter_flashplayer=10&filter_air=1.5#floodFill%28%29

    mouseX and mouseY are always the mouse position add a click listener to whatever object and just use the mouseX/mouseY or else the MouseEvent’s event.localX and event.localY for the object that the listener is attached to

    <mx:Image id="myImage" click="(myImage.content as Bitmap).bitmapData.floodFill(event.localX,event.localY,0xFFFFFF)" source="http://www.carolynsbloomingcreations.com/images/square.gif"/>
    

    Here’s a solution if you use the Flex 4.5 Hero framework otherwise I was unable to get a handle on the bitmapData through the BitmapImage, the above solution also still works with Flex 3 or 4:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:local="*">
        <s:layout>
            <s:VerticalLayout/>
        </s:layout>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    
        <!--
        <mx:Image
            id="myImage"
            click="(myImage.content as Bitmap).bitmapData.floodFill(event.localX,event.localY,0xFFFFFF)"
            source="http://www.carolynsbloomingcreations.com/images/square.gif"/>
        -->
        <fx:Script>
            <![CDATA[
                private function handleClick(event:MouseEvent):void
                {
                    trace('test');
                    var tempData:BitmapData = new BitmapData(myBitmapImage.width,myBitmapImage.height);
                    tempData = myBitmapImage.bitmapData;
    
                    var localPoint:Point = container.globalToLocal(new Point(mouseX,mouseY));
                    tempData.floodFill(localPoint.x,localPoint.y,0xFFFFFFFF);
                    myBitmapImage.source = tempData;
                    trace(localPoint.x + ":" + localPoint.y);
                }
            ]]>
        </fx:Script>
        <s:Group
            id="container"
            click="handleClick(event)">
            <s:BitmapImage
                id="myBitmapImage"
                source="@Embed('square.gif')" />
        </s:Group>
    
    
    </s:Application>
    

    even though they exposed the bitmapData in the 4.5 framework it’s read only though so I had to copy it and re-assign it to the source that seemed to work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to detect whether the current language my user is
ok i need to write a client that can be able to detect the
I need to be able to detect whether the current language my user is
I have a TileList in flex, and need to be able to detect if
Users of the website need to able to store images in their area ,
I need to be able to detect touch events on the keyboard. I have
I need to detect when the device is in portrait orientation so that I
I need to be able to detect when an icon is dropped outside its
I'm writing a qt-based c++ application and i need to be able to detect
I have a web application in C#. I need to be able to detect

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.