How to get blocks to display assets?

I’ve had a search and I can’t find the answer. I’m making my first app (an ESL quiz app) and everything is working great except trying to display images. I was following the quiz app blocks guide: Quiz App Blocks Walkthrough - YouTube

I’ve tried 2 different ways to display the right image for the right question.
1.
I have a database with questions and answers. I want to display an image with each question. I have an ‘images’ column and in there I’ve put a URL to link to the image. I used a block like this…

but that didn’t work. It wouldn’t load the image.

  1. I also have these images as assets. I named the images the same as their question number so I tried to use it with a block like this:
    image
    (because the question number is the same as the image name).

To be clear. When the student is on question 1, I want it to display the question 1 image. When they’re on question 2, I want it to display the question 2 image. I want to build it in a way where I can simply add new lines to the database without having to add new blocks for every question.
Please help.

1 Like

The image component accepts a fully qualified URL and also it will accept the name of the asset in the project such as(image1.png)

You are using a variable named Question Number, what is in it?
If it is a number then it will be used to get a data from the table but will not be used to assign a picture to the image component.

However, if the asset name is something like (image1.png, image2.png, image3.png,…)
Then you can display the image using this
image

2 Likes

This worked. Thank you so much!

I will use the assets for now and later try using URLs.

1 Like