Graphics

 View Only
  • 1.  Changing Arrows

    Posted 05-12-2015 11:34
    Dear Sir,

    A Stock Exchange template made in Xpression designer is not loading in the iNews

    due to an error that happens when I try to change the arrows textures (from "Green UP arrow" to " RED down arrow" or "Yellow dash"). Knowing that it is a Quad with a png texture. Is there another way to change between arrows? A script maybe ! rather than changing texture by choosing different png ? Please advise. Thanks. (N.B: how can I send you the project if necessary ?)


  • 2.  RE: Changing Arrows

    Posted 05-12-2015 14:18
    This can easily be done with a script. We do it here and it works great. Here's a sample code. It assumes you have a text object for the total change of a stock value.

    dim change as xpTextObject

    dim changeval as Single

    dim quad as xpBaseObject

    dim red as xpMaterial

    dim green as xpMaterial

    dim yellow as xpMaterial

    'assign to objects

    Self.GetObjectByName("Change Text Object", change)

    Self.GetObjectByName("Display Quad", quad)

    Engine.GetMaterialByName("Red Arrow", red)

    Engine.GetMaterialByName("Green Arrow", green)

    Engine.GetMaterialByName("Yellow Dash", yellow)

    'get the value of the change text object, turn it into a number to work with

    changeval=Csng(change.Text)

    'here's the actual work, where it just looks to see if the value is positive, negative, or zero

    'then sets the appropriate material on your quad

    if changeval > 0 then

    quad.SetMaterial(0, green)

    elseif changeval < 0 then

    quad.SetMaterial(0, red)

    elseif changeval = 0 then

    quad.SetMaterial(0, yellow)

    end if


    #XPression