Announcement

Collapse
No announcement yet.

User Inputs for Colors...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • User Inputs for Colors...

    I'm a little stumped at the moment... I saw an example of this a while back, but can't find it now. I'm trying to setup a color setting in the inputs. Jason suggested using eval() and gave an example of it in one post, but his example returns 0 (zero) - which is not a valid color.

    How do I take a string ("black") and convert it to a color object "Color.black"??

    I have tried joining two strings ("Color."+ncolor)

    I have tried eval("Color."+ncolor) - which returns 0

    I have tried eval(new String("Color."+ncolor)) - which returned a string (same as the first attempt).

    The resulting error is...

    Parameter Number 1 of Function setPriceBarColor is invalid.

    Any help would be appreciated.
    Brad Matheny
    eSignal Solution Provider since 2000

  • #2
    Hello Brad,

    var sColor = "black";

    setPriceBarColor( eval("Color." + sColor) );

    This is working on my end. Please post your code snippet that's not working for you.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Nevermind...

      I must have been doing something wrong, because it is now working.. Thanks Jason...

      What I did is... created global variables for all color conditions within the user inputs..

      cDefBullColor = eval("Color." + DefBullColor) ;
      cDefBearColor = eval("Color." + DefBearColor) ;
      cDefVoidColor = eval("Color." + DefVoidColor) ;

      These are setup on an initial load/reload of the efs. Then I can just call the color variables anywhere I need to access the colors..

      All I can think of is I must have lost the scope of my variables...

      Thanks again.

      B
      Brad Matheny
      eSignal Solution Provider since 2000

      Comment

      Working...
      X