Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Uncaught ReferenceError: lib is not defined

Community Beginner ,
Nov 07, 2024 Nov 07, 2024

Hi!

From my Animate Canvas file I am calling a game-scripts.js file with the following code:

 

function iniciar(){
	var pincel = new lib.pincel();
	this.addChild(pincel);
}

 

When I publish my html file, the console gives me this error:

 

Uncaught ReferenceError: lib is not defined
at iniciar (script-juegos.js:3:15)
at lib.princesa01.frame_0 (princesa01.js?1730987426814:3682:3)
at d._runActionsRange (createjs.min.js:19:7215)
at b._runActions (createjs.min.js:19:3229)
at b._runActionsRange (createjs.min.js:19:10055)
at b._runActions (createjs.min.js:19:3229)
at b.setPosition (createjs.min.js:19:1519)
at c._updateTimeline (createjs.min.js:14:29260)
at c.advance (createjs.min.js:14:28504)
at c._tick (createjs.min.js:14:28796)

 

Apparently lib is not defined. Could someone help me define lib? 

Thanks!

427
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 07, 2024 Nov 07, 2024

Hi.

 

Is the iniciar function defined within game-scripts.js? If so, you should pass the lib object as an argument to an iniciar function call in the main timeline. Like this:

// main timeline
iniciar(lib);

// game-scripts.js
function iniciar(lib)
{
 // ...
}

 

Regards,

JC

Translate
Community Expert ,
Nov 07, 2024 Nov 07, 2024

Hi.

 

Is the iniciar function defined within game-scripts.js? If so, you should pass the lib object as an argument to an iniciar function call in the main timeline. Like this:

// main timeline
iniciar(lib);

// game-scripts.js
function iniciar(lib)
{
 // ...
}

 

Regards,

JC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2024 Nov 07, 2024

Solved. Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2024 Nov 07, 2024
LATEST

You're welcome!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines