Jsui loading image files

    Jun 29 2011 | 6:44 am
    Hi, how does one load image files into a jsui object? Could someone give me a coding example? I found some info here: https://cycling74.com/docs/max5/vignettes/js/jsimageobject.html
    Sorry if this seems like a really simple question but I just can't seem to get it to work.

    • Jun 29 2011 | 7:46 am
      This is how it works:
      // define your drawing context (canvas) as 2d
      function draw(filename) {
      	// a) contsructing the new image object with the filename
      	var img = new Image(filename);
      	// b) optionally: scale the image to a certain size
      	// c) copy the pixels from the object to the drawing context
      	// d)refresh the display of jsui
      send the message [draw filename] to the jsui and the image will appear.
    • Jun 29 2011 | 7:48 am
      By the way - jsui uses JavaScript not Java (just because the thread is in the Java forum). Similar name very different things.... ;)
    • Jun 30 2011 | 3:22 pm
      moved to JavaScript forum...