A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: AS2 color picker and mixer?

  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    41

    AS2 color picker and mixer?

    I have been doing a bit of research to try and find this but i cant find specifically what im looking for.

    I want to create a simple program that just demonstrates the mix of colours in a #000000 format. I just want to create 3 boxes to represent the RGB and let the user put in random numbers in 3 separate 00-99 numbers in these boxes and you will get to see what resultant colour is in another box (the final colour)

    where can i go to find some info to research this further?

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I don't know if this is what you need, but this is why I made for you.

    http://www.mediafire.com/?68e8srenr2bf6w6

    Is in CS5 format. If you can not open it then do this:

    1- create a movieclip, name it myMovie
    2- create 3 input textfields, name them myFd1, myFd2 and myFd3.
    3- create a dynamic textfield and name it mainFd
    4- create a button or movieclip as button and name it submitButton

    then apply this script on frame 1:

    PHP Code:
    //Hexadecimal RGB Colors Picker by Angel Hdz 2013

    //Vars
    var my_color:Color = new Color(myMovie);
    var 
    myInputs "0x" myFd1.text myFd2.textmyFd3.text;  

    //Functions

    //Loop through all the input textfields
    for (04i++){
        
    //Restrict characters from Aa to Ff and numbers from 0 to 9 in each input textfield
        
    this["myFd" i].restrict="a-fA-F0-9";
        
    this["myFd" i].maxChars=2;
        
    this["myFd" i].borderColor=0x333333;
        
    this["myFd"+[i]].myNum=i;

        
    //when each input textfield receives focus, empty it
        
    this["myFd"+[i]].onSetFocus=function()
        {
            
    _root["myFd" this.myNum].text="";
        }
    };

    //Set default color, red (#FF0000)
    my_color.setRGB(myInputs); 
    trace(myInputs);

    //Buttons

    //Submit Button
    submitButton.onPress=function()
    {
        if(
    myFd1.text == "" || myFd2.text == "" || myFd3.text == "" )
        {
        
    mainFd.text"Empty fields!";

        }
        else {
        
    myInputs "0x" myFd1.text myFd2.textmyFd3.text;  
        
    my_color.setRGB(myInputs); 
        
    mainFd.text"#"myFd1.text myFd2.textmyFd3.text;
        
        }

    *Remember to embed fonts


    PD: If you need a table of all the hex web safe colors, let me know, i can create it with a loop/array
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Very good Angel. but it look suspiciously unlike your coding.

  4. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I have always said here in this forum that i have 2 great teachers , Nig13 and Fruitbeard

    How am I doing it, master?


    PD: I have a few actionscript 2 PDF bibles and manuals, I have made my homework too
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center