Skip to main content
Participating Frequently
April 3, 2017
Answered

Load random images with associated links in HTML5 Canvas

  • April 3, 2017
  • 1 reply
  • 562 views

I see lots of old examples of randomly loading images or URLs using ActionScript, but nothing recent for HTML5 Canvas. Can anybody help direct me how I could load random images (or movie clips), along with associated links, into a movie clip? I want to create a simple web banner that loads different product images with links to their respective product pages. Many thanks for any insight.

This topic has been closed for replies.
Correct answer kglad

i can't think of anything easier than putting each product on a frame.  then display a frame selected randomly.

1 reply

kglad
kgladCorrect answer
Community Expert
April 4, 2017

i can't think of anything easier than putting each product on a frame.  then display a frame selected randomly.

Participating Frequently
April 6, 2017

Thank you kglad for the great suggestion. I followed up with another thread to find the exact code needed (thanks Colincolinqawu6 re: Random Frame):

this.gotoAndPlay(15+Math.random()*10);

In this example it would jump to a random frame in the range of 15 to 24. Change the start frame number and the number of different frames, to match your case.

kglad
Community Expert
April 6, 2017

you're welcome.