469,270 Members | 1,778 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

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

http://blog.paranoidferret.com/index...-color-picker/

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

---

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

function redBoxChanged(e)
{
currentColor.SetRGB(parseInt(document.getElementBy Id("redBox").value), currentColor.Green(), currentColor.Blue());
colorChanged("box");
}

var HexValue = document.getElementById(hexBox).getValue;

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

giovanni
Oct 15 '07 #1
13 1864
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Try:
Expand|Select|Wrap|Line Numbers
  1. function hexboxChanged() {
  2.  alert(document.getElementById('hexBox').value);
  3. }
Oct 15 '07 #2
Welcome to TSDN!

Try:
Expand|Select|Wrap|Line Numbers
  1. function hexboxChanged() {
  2.  alert(document.getElementById('hexBox').value);
  3. }
ty acoder. and thanks for speedy reply. :D


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

Expand|Select|Wrap|Line Numbers
  1. var HexValue = "#123456";
  2. TNTDoCommand('SceneGraph.Objects(*).SetColorTint('+HexValue+')');
i am working at a 3d design agency which deals in real time interactive models which runs online.

the "TNTDoCommand" 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.
Oct 16 '07 #3
acoder
16,027 Expert Mod 8TB
Replace
Expand|Select|Wrap|Line Numbers
  1. var HexValue = "#123456";
with
Expand|Select|Wrap|Line Numbers
  1. var HexValue = document.getElementById('hexBox').value;
Oct 16 '07 #4
i shall try give it a try later. think i did try that code but never put ' in them...
Oct 16 '07 #5
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
File Type: zip rgb picker.zip (4.8 KB, 68 views)
Oct 16 '07 #6
acoder
16,027 Expert Mod 8TB
What's supposed to happen in the attached example file?
Oct 16 '07 #7
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
Expand|Select|Wrap|Line Numbers
  1. var hexValue = redBox +  greenBox + blueBox;
or something else which i dont see...
Oct 17 '07 #8
acoder
16,027 Expert Mod 8TB
You have a number of "failed attempts" in the source code. What is supposed to be retrieved for colorValue?
Oct 17 '07 #9
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
Oct 18 '07 #10
acoder
16,027 Expert Mod 8TB
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.
Oct 18 '07 #11
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.
Oct 18 '07 #12
acoder
16,027 Expert Mod 8TB
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?
Oct 18 '07 #13
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
Expand|Select|Wrap|Line Numbers
  1. var a = false;
  2. var b = false;
  3. var c = false;
  4.  
  5. function lightMode () {
  6.     if (a == true) {
  7.         TNTDoCommand('Scenegraph.Objects("agroup*").SetColourTint('+hexValue+')');
  8.         }
  9.     if (b == true) {
  10.         TNTDoCommand('Scenegraph.Objects("bgroup*").SetColourTint('+hexValue+')');
  11.         }
  12.     if (c == true) {
  13.         TNTDoCommand('Scenegraph.Objects("cgroup*").SetColourTint('+hexValue+')');
  14.         }
  15.     else {
  16.         //do nothing
  17.         }
  18. }
  19.  
  20. /*
  21. if checkbox a selected
  22.     var a = true;
  23.     same case to var b and c
  24. */
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...
Oct 18 '07 #14

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Jason Charalambides | last post: by
3 posts views Thread by adam.sherratt | last post: by
2 posts views Thread by Need Helps | last post: by
3 posts views Thread by Darhl Thomason | last post: by
1 post views Thread by Dica | last post: by
reply views Thread by WLigtenberg | last post: by
reply views Thread by wishbone34 | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.