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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:09:11+00:00 2026-05-13T02:09:11+00:00

Can anybody help me out? I would like to store a hex colorPicker value

  • 0

Can anybody help me out?
I would like to store a hex colorPicker value in a variable and then cast the value of the var backout to a textInput. The textInput is just to see witch hexcolor i have choosen.

thus meaning seeing 0x000000 in the textInput.

what i’ve done now is pretty simple i have bound the flex colorPicker directly to my textInput. but i want to store the value from the colorPicker in a var first and than spit it backout to the textInput to see the value that i have picked.

When i pick a color value that begins with the number 0 it drops the 0’s at the beginning of the number and only spits out the numbers greater than 0. (000033 becomes 33, FF0000 stays FF0000).
I want to catch the whole value or write some kind a function to figure out how many 0’s got dropped and concatenate it together with 0x. Store that all into a var and bind it to the flex TextInput. But i don’t know how to do that. Does anybody know what i must do?

This is what i’ve got.

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" 
           layout="vertical" 
           width="100%" 
           height="100%">


<mx:ColorPicker id="bgColor"/>
<mx:TextInput text="{bgColor.selectedColor.toString(16)}"/>

<mx:Canvas width="100" height="100" backgroundColor="{bgColor.selectedColor}"/>

</mx:Module>

Thank

DJ

  • 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-13T02:09:12+00:00Added an answer on May 13, 2026 at 2:09 am

    The colorchosers selected color is a uint and what you need to do is covert this to hex. I did a quick google for you and found a solution here

    Here is my own take on it

    <mx:ColorPicker id="bgColor" change="colourChange()"/>
    <mx:TextInput id="txtColour" />
    
    <mx:Canvas width="100" height="100" backgroundColor="{bgColor.selectedColor}"/>
    
    <mx:Script>
        <![CDATA[
    
            private function colourChange():void
            {
               var hexString:* = bgColor.selectedColor.toString(16).toUpperCase();
               var cnt:int = 6 - hexString.length;
               var zeros:String = "";
    
               for (var i:int = 0; i < cnt; i++) 
               {
                    zeros += "0";
               }
    
               txtColour.text =  "#" + zeros + hexString;
            }
    
        ]]>
    </mx:Script>
    

    Excuse the bad code formatting above!!!

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

Sidebar

Related Questions

I am not that expert in SSIS. Can anybody help me out on my
Can anybody help me in finding out how to verify that _tmkdir succeeded. For
Can anybody help how to setup a automatic backup of mysql database and then
Can anybody give me some help for figuring out the problem below. Here are
maybe anybody can help me out with a quite strange behaviour using hibernate and
I would be grateful if anybody could help me out with this. I have
Can any body help me out how to clear the items in the list
Can anybody help me how can I invoke a JSP page from a Servlet
can anybody help me understand how Honda achieved this effect: http://testdays.hondamoto.ch/ I mean the
can anybody help me how to nice integrate doctrine 2.0 into ZF 1.10? I

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.