RGB Sliders/Pickers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoleo1986
    New Member
    • Oct 2007
    • 8

    RGB Sliders/Pickers

    Hi this is my first post and i hope that am displaying correct information to post standards.

    in short i am using a rgb picker used from this tutorial



    my main goal is to simply extract the hex value and make an alert out of it.

    ---

    [HTML]<input size="8" id="hexBox" onchange="hexBo xChanged();" type="text">

    function redBoxChanged(e )
    {
    currentColor.Se tRGB(parseInt(d ocument.getElem entById("redBox ").value), currentColor.Gr een(), currentColor.Bl ue());
    colorChanged("b ox");
    }

    var HexValue = document.getEle mentById(hexBox ).getValue;

    function TellMe()
    {
    alert(+HexValue )
    }
    [/HTML]
    ---

    giovanni
    Last edited by gits; Oct 15 '07, 01:06 PM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    Try:
    [CODE=javascript]function hexboxChanged() {
    alert(document. getElementById( 'hexBox').value );
    }[/CODE]

    Comment

    • geoleo1986
      New Member
      • Oct 2007
      • 8

      #3
      Originally posted by acoder
      Welcome to TSDN!

      Try:
      [CODE=javascript]function hexboxChanged() {
      alert(document. getElementById( 'hexBox').value );
      }[/CODE]
      ty acoder. and thanks for speedy reply. :D


      i just realized that i forgot to add another string of code

      Code:
      var HexValue = "#123456";
      TNTDoCommand('SceneGraph.Objects(*).SetColorTint('+HexValue+')');
      i am working at a 3d design agency which deals in real time interactive models which runs online.

      the "TNTDoComma nd" string wildcards all objects created in the scene, and end desire is to change colour tint to those objects or specific ones later. using the colour picker user can pick new value and "var HexValue" will be updated and applyed.
      Last edited by geoleo1986; Oct 16 '07, 07:12 AM. Reason: taking out spam bluntly put... getting straight to point

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Replace[CODE=javascript]var HexValue = "#123456";[/CODE] with [CODE=javascript]var HexValue = document.getEle mentById('hexBo x').value;[/CODE]

        Comment

        • geoleo1986
          New Member
          • Oct 2007
          • 8

          #5
          i shall try give it a try later. think i did try that code but never put ' in them...

          Comment

          • geoleo1986
            New Member
            • Oct 2007
            • 8

            #6
            tried that code and still no luck

            have cleaned out some code and somehow lost some posting for files. unless im going crazy. but think it was just links above.

            could i send you a copy of the code? i put it all into a single file. tried sending it to you via email but admin only

            saw additional options of uploading files so uploaded a zip file.
            Attached Files

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              What's supposed to happen in the attached example file?

              Comment

              • geoleo1986
                New Member
                • Oct 2007
                • 8

                #8
                Originally posted by acoder
                What's supposed to happen in the attached example file?
                the attached is the code i am using (cleaned of code unrelated to the picker). i know there are other id's which i could you

                ie
                Code:
                var hexValue = redBox +  greenBox + blueBox;
                or something else which i dont see...

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  You have a number of "failed attempts" in the source code. What is supposed to be retrieved for colorValue?

                  Comment

                  • geoleo1986
                    New Member
                    • Oct 2007
                    • 8

                    #10
                    hhmmm... ill redo the code then ill post a new updated version. ill try and find and clean those bugs... thx acoder

                    ps might be while till next post

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Originally posted by geoleo1986
                      hhmmm... ill redo the code then ill post a new updated version. ill try and find and clean those bugs... thx acoder
                      The "failed attempts" were all commented out anyway but I was wondering what colorValue was unless it was an old name for hexValue.

                      Comment

                      • geoleo1986
                        New Member
                        • Oct 2007
                        • 8

                        #12
                        Originally posted by acoder
                        The "failed attempts" were all commented out anyway but I was wondering what colorValue was unless it was an old name for hexValue.
                        hexValue or colorValue = rgb hex value...

                        probably a line i forgot to change... sorry about that.

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #13
                          When is the lightMode function called?

                          When do you want to use this hex value? Do you use a button that has to be clicked to decide what colour has been chosen?

                          Comment

                          • geoleo1986
                            New Member
                            • Oct 2007
                            • 8

                            #14
                            i plan on adding code (check boxes) which will call certain objects in scene.

                            if (eg a-e) is picked catagory a is selected and if more than one selected does changes to all...

                            i made rough code but i know it doesnt work but ill explain after quote
                            Code:
                            var a = false;
                            var b = false;
                            var c = false;
                            
                            function lightMode () {
                            	if (a == true) {
                            		TNTDoCommand('Scenegraph.Objects("agroup*").SetColourTint('+hexValue+')');
                            		}
                            	if (b == true) {
                            		TNTDoCommand('Scenegraph.Objects("bgroup*").SetColourTint('+hexValue+')');
                            		}
                            	if (c == true) {
                            		TNTDoCommand('Scenegraph.Objects("cgroup*").SetColourTint('+hexValue+')');
                            		}
                            	else {
                            		//do nothing
                            		}
                            }
                            
                            /*
                            if checkbox a selected
                            	var a = true;
                            	same case to var b and c
                            */
                            check boxes for linked to object groups (agroup*; bgroup*; cgroup*;)
                            when checkbox selected set var a/b/c = true; then triggers lightmode
                            as the hexvalue changes reactivates lightmode and recolours object group

                            unfortunately work has been pulling me away from this code so havent written any solid code for this scenario...

                            Comment

                            Working...