Skip to main content
Participant
April 1, 2022
Question

Issue with using Create JS in Animate to use external assets (images/audio)

  • April 1, 2022
  • 1 reply
  • 444 views

Hi!

Im trying to make an interactive html ad using Adobe Animate and I do know how to do with the tools it provides while having assets stored either on a local drive or in a folder on a server. But the issue is that my client wants me to export the ad as HTML and wants me to use all the assets from the web (he's providing me with all the URL links) but I have no idea how to use create js' libraries and commands so I can use those links to import the assets into the projects.

I'd really appreciate if someone could help!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 1, 2022

what kind of assets?

 

(and the client is aware that doing loading the assets is going to cause a delay in the ad's appearance.)

Participant
April 1, 2022

multiple png images and mp3 audio file (most likely 10 seconds long loop)

im pretty sure he has 0 knowledge about it but it shouldn't be an issue because ill ask him to compress everything first as much as possible

kglad
Community Expert
Community Expert
April 1, 2022

to load images

 

if(!alreadyExecuted){

this.imageA = [];

var imagePaths("./images/image1", etc);

alreadyExecuted = true;

var index = 0;

imageF.bind(this)(imagePathA[0])

}

 

function loadF(){

imageF(imagePathA[index])

}

 

function imageF(imgPath) {
var image = new Image();
image.onload = onLoadF.bind(this);
image.src=imgPath;

}

function onLoadF(e) {
var img = new createjs.Bitmap(e.target);

this.imageA.push(image);  // still hasn't been added to display list or positioned

index++;

if(index<imagePathsA.length){

imageF.bind(this)(imagePathA[index])

} else {

// loading complete. do whatever

}

}

 

to load sound and play a sound:

 

createjs.Sound.registerSound(path to sound, "soundID");

 

this.your_button.addEventListener('click',playF.bind(this));

 

function playF(){
var soundInstance = createjs.Sound.play("soundID");
//soundInstance.addEventListener("complete",cF.bind(this));  // if you want to know when sound completes play

}

 

");