Solved: Access to Assets

danielle53

  • *
  • Posts: 55
Say, I want to make an extension with some specific assets I don't want to put before hand in /extras
for example an image.

I put inside my include.nmml

Code: [Select]
<assets path="images/MyImage.png"  id="MonImage"/>
I can test the access by

Code: [Select]
if (Assets.exists("MonImage", AssetType.IMAGE)){
trace("I've got MyImage by Id");
}

It is ok, but I want to be able to test by path ...

I know that I can put a rename tag

<assets path="images/MyImage.png"  rename="path/to/MyImage.png"/>

But I unable to find a path that doesn't answer "false" to the question

Assets.exists("path/to/MyImage.png",AssetType.IMAGE)

Thanks for any help

« Last Edit: February 11, 2017, 05:07:30 am by danielle53 »

danielle53

  • *
  • Posts: 55
I found out that
Code: [Select]
<haxeflag name="-resource" value="images/MyImage2.png" />was I wanted (for now)

but in fact, for several images,  it is simpler to let Stencyl do the job .. with an adequate rename
Code: [Select]
<assets path="images" rename="assets/data" include="*.jpg|*.png" exclude="myportrait.jpg" />

« Last Edit: February 11, 2017, 06:01:49 am by danielle53 »