Skip to main content
Inspiring
December 4, 2018
Answered

Path to images from library

  • December 4, 2018
  • 1 reply
  • 705 views

Hi,

I have an Animate animation for HTML5/canvas. In the library, a clip is exported via a link ID. This clip includes an instance of a bitmap image on its timeline.

If I add an instance of the clip to the main stage and compile the animation, I can see the clip and the image, as expected.

If I open the resulting html file (as exported by Animate), everything also works fine: I can see the image.

Now here comes the tricky part:

Rather than opening the exported html file, I have another html page, with hand-made javascript code to instantiate the clip from the library.

It works–I can see the clip, but not the image inside.

The library is not stored in the same level as the main HTML file, but rather in a sub-sub-folder, and so is the /images/ directory.

So it makes sense somehow that the main file might not be able to guess where to find the image.

Looking inside the library's javascript file, I find this:

lib.properties = {

...

     manifest: [

          {src:"images/_01.png?1543916442531", id:"_01"}

          ],

...

};

So I assumed that I needed to edit the image path to adapt it to the main file:

src:"anim/Tests/images/_01.png?1543916442531", id:"_01"

"anim" being a folder at the same level as the main html file.

But it doesn't work: the image never appears.

I've also tried to move the library files to the root of the project (at the same level as the main html file), but it doesn't work either.

Any idea?

Also, I do not get any error message from the console.

This topic has been closed for replies.
Correct answer denisr704218734737017

OK, I've solved the issue.

My main file needed the handleFileLoad function.

However, I also need to manually change the path to the images folder, which is not ideal.

I need to find a way to do it dynamically.

1 reply

denisr704218734737017AuthorCorrect answer
Inspiring
December 4, 2018

OK, I've solved the issue.

My main file needed the handleFileLoad function.

However, I also need to manually change the path to the images folder, which is not ideal.

I need to find a way to do it dynamically.

Inspiring
December 4, 2018

I ended up relocating all the library files at the root of the project.

But I'm still able to dispatch the image files into one different folder for each library:

images/lib1/

images/lib2/

...

So all in all, it's not too bad.

Legend
December 4, 2018

I think I've read this thread at least five times and I still don't understand what you're trying to do.