How to change image randomly in image component

How to change image randomly

I want to change image randomly from assets every time when screen initialise

Can any ony help me out here

Yes…
There are several ways for that…

  1. you can use tinyDB for that…
    When screen initialises add +1 on tinyDB value and set a specific image for specific tinyDB value…
  2. you can use list block…
    Make a list of assets name [with .png or .jpg]
    Then everytime screen initialises set image picture to random item from the list…
    :thinking:
    There could be other ways too
2 Likes

Done bro my problem solved

I used global variable to change image randomly on screen initialize

By the way thank for your reply brother :hugs:

DrJohns second point is the only one that would work.

The first option will break when you run out of images.

Here is the second options in blocks.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.