Graphics

 View Only
  • 1.  data change trigger

    Posted 10-05-2020 23:31

    hi, i have a text field that is populated by a datalinq. when the text in that field changes, i'd like the original text to fade off, and the new text fade on.  whats the best way to achieve this?

    thanks.

     



  • 2.  RE: data change trigger

    Posted 10-24-2020 13:22

    Hi James,

     

    First of all, you can not do this on the Datalinq'ed textfield directly. Whenever the value changes it will be reflected instantly in the textfield so fading out the old text and fading in the new text is not possible on the textfield itself.

     

    However, you can achieve this using a dummy textfield and some scripting.

    So you would need two separate textfields. One dummy field which can be hidden and which is updated using Datalinq and a second textfield which will fade out, update the text and fade back in again.

     

    So on the dummy textfield you need to set up the Datalinq but you also need to set up a script event on that textfield using the OnSetText-script.

    The script you would need is below.

    dim content as string = Text
    dim txtObj as xpTextObject

    ' LINK THE TEXT OBJECT THAT NEEDS TO FADE
    Scene.GetObjectByName("fadeText", txtObj)

    ' FADE OUT THE CURRENT TEXTFIELD
    txtObj.FadeRange(100,0,50,0,true)

    ' UPDATE THE CONTENT OF THE TEXTFIELD
    txtObj.Text = content

    ' FADE IN THE TEXTFIELD AGAIN
    txtObj.FadeRange(0,100,50)

    Some values that you need to change according to your needs:

    "fadeText" => this is the name of the field that needs to fade in.

    txtObj.FadeRange(100,0,50,0,true) => the value of 50 determines the duration of the fade out. In this case 50 frames.

    txtObj.FadeRange(0,100,50) => the value of 50 determines the duration of the fade in. In this case 50 frames.

     

    Best regards,

    Kenneth

     


    #XPression