Skip to main content
jeffery wright
Inspiring
October 3, 2018
Answered

Animate CC HTML5 - Load image from url into movie clip

  • October 3, 2018
  • 1 reply
  • 1346 views

Simply put, when a frame is jumped to, it contains this code:

this.p_Image.children[0].image.src = "http://website.com/image.jpg";

My Movie Clip's instance name is "p_Image", it contains a placeholder bitmap within it and nothing else. It is a layout element which needs to display a specific image depending on which frame is currently displayed.

the console error I get is:

Cannot read property 'children' of undefined

What is not defined here? Shouldn't this be a very simple?

Any insight would be helpful, thanks!

This topic has been closed for replies.
Correct answer ClayUUID

It certainly does exist, so this should work, right?

But for some reason it doesn't.

This sums up the entirety of my experience with Animate CC nicely.

Does anyone know if there is a FLA file somewhere that shows this seemingly very common feature actually working?

I can't be the only one who would like to see that.

Have you ever been able to get this to work?

Thanks.


Okay, this is very important. When I asked you to insert alert(this.p_Image); preceding your image-setting code, did you place it immediately before it? There was nothing in between? Nothing that would change the value of this? Because what you're describing is exactly what would happen if someone messed up using an event handler to target an instance.

1 reply

Brainiac
October 3, 2018

When in doubt, always confirm your assumptions. Stick an alert(this.p_Image); in front of that code. Maybe an alert(this); too for good measure.

jeffery wright
Inspiring
October 3, 2018

I don't know how helpful this alert is:

[MovieClip (name=p_Image)]

What is it supposed to do?

Thanks.

ClayUUIDCorrect answer
Brainiac
October 4, 2018

It certainly does exist, so this should work, right?

But for some reason it doesn't.

This sums up the entirety of my experience with Animate CC nicely.

Does anyone know if there is a FLA file somewhere that shows this seemingly very common feature actually working?

I can't be the only one who would like to see that.

Have you ever been able to get this to work?

Thanks.


Okay, this is very important. When I asked you to insert alert(this.p_Image); preceding your image-setting code, did you place it immediately before it? There was nothing in between? Nothing that would change the value of this? Because what you're describing is exactly what would happen if someone messed up using an event handler to target an instance.