Adding Image dynamically using each

MainView.js

category=[{"image":"Assets/1.jpg"},{"image":"Assets/2.jpg"},{"image":"Assets/3.jpg"}]

MainView.ux

i’m Using Each Item="{category}" Image File="{image}" end of Each

now every time i run it. it works in local but not in my device. error:(Directory not found: Assets/1.jpg).

how can i access image in an array using each element?

Hi!

In the current version (0.9.11) images must be declared in UX files in order to be bundled into the app bundle. This means you have to do this similar to how it is shown in these examples:

https://www.fusetools.com/examples/navigation-animation https://www.fusetools.com/examples/gallery

Basically, declare each image in UX like this:

<FileImageSource File="Assets/Pictures/Unsplash6.jpg" ux:Key="Unsplash6" />

And then use the key (here: Unsplash6) as the handle from JS.

In a near future version, you can specify what images to bundle in your unoproj, and point to it by filename in JS. However, this is not released yet as of 0.9.11

Hi Anders Lassen

I see… Thankyou for the response. Hoping to have that feature sooner. It is really needed for more dynamic data binding.