Display different image based on text


#1

Hey,

In an experience we’re building, we’re getting data from a server. Its a bunch of ads put up by users. They have two categories. Offer and request. They are stored in 1 database. When grabbing the data in an asset grid, I want to display images representing the categories. Right now I have it set up so the category text element has two triggers.

1: if category text equals “offer” change image 1 to "offer.png"
2. if category text equals “request” change image 1 to “request.png”

This works in principle, but i’m having an issue where it needs to have a delay. The triggers are set so they fire after 0,5 seconds, and it’s very noticeable the images are loading in.

Do you guys know of any better way to do this? I’m curious!


#2

Here’s one thing to try:

  • Use an Asset Grid of Flip Charts. Each flip chart has two items “Offer” and “Request”. Use your if-then statements to flip the chart to index 1 or 2. That way, the images are loaded in advance and will be readily available.

I don’t know enough to know if this will apply - but one of my favorite things to do is to use the “is equal to” binding converter. For example, you could bind the index of a flip chart to a variable, and use the “is equal to” = “Offer”. The flip chart will only flip if the variable is “Offer”

Just a couple ideas, good luck!


#3

Hey @abel.arnoldussen,

Depending how many items you have in your list, but you could indeed put the 2 images and bind their visibility to the category. Use the is equal to converter as advised by @AlexB to the image visible if the category equals “offer” or “request”.

Tell us if that would work for you.

Seb


#5

Whoops, posted from the wrong account…

That worked pretty well, tnx :smiley:

Walking into a new problem tough. I have a pretty similar setup to this webcast: https://www.youtube.com/watch?v=pmpE9XZWA8U

When you press an item in the asset grid, a popup comes up with more information. The thing is: I want the category image on the popup as well. I’ve tried using the same triggers as in the asset grid itself, but that’s not working. Any ideas?

Thanks!