Using getProperty() on an image created with image()

csp-unit-5-lesson-1
#1

When I create an image using the image() block, I don’t seem to be able to access its “properties” using the getProperty() block.

The following would output null, instead of the height of the image:

image(“logo”, “http://code.org/images/logo.png”);
console.log(getProperty(“logo”, “height”));

Is there a way to get it to do what I want it to do?

Thanks in advance,
Bill

#2

That definitely feels like a bug. I’ve reported it to our engineers to look at.

1 Like
#3

Great. Please keep me posted.

I’m finishing up a program and lesson that uses getProperty() as part of the collision detection. I’d like to avoid hard coding in the width and the height because that seems sloppy.

Bill