How do I call image from XML

Get help using Construct 2

Post » Tue May 10, 2016 5:30 am

Hi,

I am able to call image by adding an image in files folder and by calling in a sprite from 'load image from URI' but I want to do this through XML as I am able to call text and audio from XML but not image.

In simple terms I want to put images in file folder and call from XML when required like this.

<question>
<sound>face.mp3</sound>
<text>A face.</text>
<good_image>face.png</good_image>
<bad_image>leg.png</bad_image>
</question>

Also in files folder creating subfolder and calling image from URI is also not working. This also my main concern to call from XML.


Regards
M
B
6
Posts: 16
Reputation: 272

Post » Tue May 10, 2016 10:26 am

I am able to call text and audio from XML but not image.

so... if you set Text to
Code: Select all
XML.StringValue("//question/good_image/text()")

you get "face.png"

but... you can't load image?
from
Image
Image
B
65
S
23
G
7
Posts: 1,501
Reputation: 10,888

Post » Wed May 11, 2016 5:40 am

Yes exactly. I am not able to do this in Construct 2 but after exporting the HTML5 output I can change code but I want it natively. Please advice.
B
6
Posts: 16
Reputation: 272

Post » Thu May 12, 2016 1:53 am

test this capx.... faceLeg.capx

Image
Image
B
65
S
23
G
7
Posts: 1,501
Reputation: 10,888

Post » Thu May 12, 2016 10:01 am

Thanks Korbaach that is a great help. I am making a mistake of not using // and not getting this result. That's a great help.

Cheers :)
B
6
Posts: 16
Reputation: 272


Return to How do I....?

Who is online

Users browsing this forum: eochranek, fearfulelephants and 18 guests