Graphics

 View Only
  • 1.  changing colors of characters based on value(s) in the RSS feed.

    Posted 03-17-2015 20:04
    If a number is 0 to greater than 0 it is Green.... this number would be a number from an RSS feed. If a number is -1 or less than -1 it is RED.... this number from the same RSS feed.

    Any info on how to achieve this functionality?

    Or, a link with instructional info out there?

    Thank you.

    Anthony


  • 2.  RE: changing colors of characters based on value(s) in the RSS feed.

    Posted 03-17-2015 20:10
    Visual Logic:

    XPression U - Visual Logic

    You could use the Logic or Selector blocks to assign a material to the face of your text based on the the value from a Datalinq block.

    #XPression


  • 3.  RE: changing colors of characters based on value(s) in the RSS feed.

    Posted 03-18-2015 14:43
    If you're not using Visual Logic, you could do it with scripting. You will basically create a temporary text placeholder, empty the text into that, change the font of the text object, then bring the text back in to have it change the font. Here's a rough script that would do it:

    dim txt as xpTextObject

    dim txtnum as single

    dim temp as string = nothing

    dim green as xpFont

    dim red as xpFont

    Self.GetObjectByName("text", txt)

    txtnum=Csng(txt.Text)

    Engine.GetFontByName("Green Font", green)

    Engine.GetFontByName("Red Font", red)

    if txtnum > 0 or txtnum = 0 then

    temp=txt.Text

    txt.Text=""

    txt.CurrentFont=green

    txt.Text=temp

    elseif txtnum < 0 then

    temp=txt.Text

    txt.Text=""

    txt.CurrentFont=red

    txt.Text=temp

    end if


    #XPression


  • 4.  RE: changing colors of characters based on value(s) in the RSS feed.

    Posted 03-25-2015 18:11
    Here's a script applied to a text object that we use for financials/stocks:

    OnSetText

    dim number as xpTextObject

    scene.getObjectByName("change", number)

    if cDbl(text) >= "0" then

    text = "{ChangeGreen}" & "+" & text

    else

    text = "{ChangeRed}" & text

    end if


    {ChangeGreen} and {ChangeRed} are the names of the fonts within the project

    #XPression


  • 5.  RE: changing colors of characters based on value(s) in the RSS feed.

    Posted 03-25-2015 20:48
    I never thought to use font tags in the script. I should modify my scripts to use that instead. Much cleaner.

    EDIT: I've spent too much time on Reddit. I looked for an "upvote" button for your post.

    #XPression