Skip to main content
Inspiring
May 2, 2022 10:06 PM UTC
Answered

Uncaught TypeError when adding a new movie clip

Hi Animate,

I'm trying to call a library movie clip with code that worked for identical clips but gives the error "lib.bellSideWht is not a constuctor" for the new one I just added.  As far as I can see, the code for the existing library item (which works) is identical to the code for the new library item which doesn't work.  The code below shows code for both clips -- the one on the top works (starSideRt_01), the one on the bottom doesn't (bellSideWht_01).  Any help will be appreciated.

 

//this is the code on the button which is nested 
this.starSideRt_01_btn.addEventListener("click", getStarSideRt.bind(this));
this.starSideRt_02_btn.addEventListener("click", getStarSideRt.bind(this));
this.starSideRt_03_btn.addEventListener("click", getStarSideRt.bind(this));


function getStarSideRt()
{
	exportRoot.positionStarSideRt();
}

this.bellSideWht_01_btn.addEventListener("click", getBellSideWht.bind(this));
this.bellSideWht_02_btn.addEventListener("click", getBellSideWht.bind(this));
this.bellSideWht_03_btn.addEventListener("click", getBellSideWht.bind(this));

function getBellSideWht()
{
	exportRoot.positionBellSideWht();
}

 

//this is the code on the main timeline
this.positionStarSideRt = function()
{
	const starSideRt_mc = new lib.starSideRt();		
	this.addChild(starSideRt_mc);
	starSideRt_mc.x = 200;
	starSideRt_mc.y = 200;
	starSideRt_mc.scale *= 0.45;

	starSideRt_mc.addEventListener("pressmove", moveSomeFlower.bind(this));
	starSideRt_mc.addEventListener("click", clickSomeFlower);
	
}

this.positionBellSideWht = function()
{
	console.log("hello");
	const bellSideWht_mc = new lib.bellSideWht();		
	//this.addChild(bellSideWht_mc);
	//bellSideWht_mc.x = 200;
	//bellSideWht_mc.y = 200;
	//bellSideWht_mc.scale *= 0.45;

	//bellSideWht_mc.addEventListener("pressmove", moveSomeFlower.bind(this));
	//bellSideWht_mc.addEventListener("click", clickSomeFlower);
	
}

 

This topic is closed to new replies. Start a new post to keep the conversation going.
ZafferCorrect answer
Inspiring
May 3, 2022 3:05 PM UTC

Hi JC,

Yes, I had the linkage name in the Library.  There is nothing wrong with the code, it was something with the movie clip, bellSideWht_mc.  It's a complicated clip with nested subclips and I made it in a hurry by breaking down an existing clip and using the art work, but I must have done something that somehow made it not a constructor.  I started over, made a new clip with original art work and now it works perfectly.  Thanks for your reply.

Zaffer

3 replies

JoãoCésar17023019
Community Expert
Community Expert
May 3, 2022 10:49 AM UTC

Hi.

 

Is there a symbol with a linkage name of bellSideWht in the Library?

 

Please let us know.

 

Regards,

JC

Translate
ZafferAuthorCorrect answer
Inspiring
May 3, 2022 3:05 PM UTC

Hi JC,

Yes, I had the linkage name in the Library.  There is nothing wrong with the code, it was something with the movie clip, bellSideWht_mc.  It's a complicated clip with nested subclips and I made it in a hurry by breaking down an existing clip and using the art work, but I must have done something that somehow made it not a constructor.  I started over, made a new clip with original art work and now it works perfectly.  Thanks for your reply.

Zaffer

Translate
JoãoCésar17023019
Community Expert
Community Expert
May 3, 2022 4:22 PM UTC

Great, Zaffer.

 

I'm glad you figured it out.

 

Regards,

JC

Translate