Skip to main content
Jeffery.Wright
Inspiring
May 29, 2025
Answered

Loading external image into a movieClip - HTML5 Canvas

  • May 29, 2025
  • 1 reply
  • 316 views

I have a function that is to populate a movie clip with the values of variables. 

this.pd_PTSVBBEVA=function(){
// This all works fine:
exportRoot.PTSVBBEVA.pDisplay.pName.text = t_PTSVBBEVA;
exportRoot.PTSVBBEVA.pDisplay.pDesc.text = c_PTSVBBEVA;
PP_URL = u_PTSVBBEVA;

// this bit does not:
var pPic = new createjs.Bitmap(p_PTSVBBEVA);
exportRoot.PTSVBBEVA.PDisplay.pic.addChild(pPic);
exportRoot.PTSVBBEVA.PDisplay.pic.scaleX = .2; exportRoot.PTSVBBEVA.PDisplay.pic.scaleY = .2;
}

 

The error produced: Uncaught TypeError: Cannot read properties of undefined (reading 'pic')

 

 

'pic' is certainly there in my MC, it is an empty MC:

 

 

Looks like it should work, I have a similar function that populates another type of MC in other applications that displays the image just fine, what might I be missing here?

Thanks! 

 

Correct answer JoãoCésar17023019

Hi.

 

Inside the function you have exportRoot.PTSVBBEVA.pDisplay and outside of it you have exportRoot.PTSVBBEVA.PDisplay. So I guess you need to correct the case for pDisplay or PDisplay.

 

Regards,

JC

1 reply

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
May 29, 2025

Hi.

 

Inside the function you have exportRoot.PTSVBBEVA.pDisplay and outside of it you have exportRoot.PTSVBBEVA.PDisplay. So I guess you need to correct the case for pDisplay or PDisplay.

 

Regards,

JC

Jeffery.Wright
Inspiring
May 30, 2025

You're absolutely correct, I made a rookie mistake... how emberassing! Thank you!

JoãoCésar17023019
Community Expert
Community Expert
May 30, 2025

Great!

 

No problem at all!