Hey again,
Returning after some code tweaks, I still can’t get images to display from RSS. I’ve significantly refactored my code and have successfully created a tool for grabbing and loading images. The problem arises when trying to display the images; I don’t know how to access loaded images from a class.
Here’s my code for loading images:
let getImages = function(xml) {
let items = xml.getChildren("item");
for (let i = 0; i < 10; i++ ) {
let URL = items[i].getChild('media:content');
if (URL) {
photos.push(URL.getString('url'));
}
}
for (const k of photos) {
new thingTemp(loadImage(k));
console.log(thingTemp.photos);
}
};
and here’s the class I’m using:
class thingTemp {
constructor(photos) {
this.x = random(windowWidth),
this.y = random(windowHeight),
this.lifespan = 80,
this.photos = photos
}
This is the method used to display the image:
display () {
tint(255, this.lifespan);
//image(photos[0], windowWidth/2, windowHeight/2);
}
Whenever I console.log(thingTemp.photos) I get “undefined.” Obv that’s problematic because I can’t display an image from a non-existent URL.
Any help would be much appreciated,
Veirkant S.