Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Custom Logo Within the Loader


Cary Crusiau
 Share

Recommended Posts

Hello,

 

Is it possible to add a custom logo within the loader? I tried to add one

var logo = new game.Sprite('media/logo.png');

inside the initStage function but received the following error:

 

"Uncaught Error: The frameId “media/logo.png” does not exist in the texture cache.”

 

I tried with 'Sprite.fromImage' but received this other error:

 

"Uncaught TypeError: undefined is not a function"

 

TIA for your help!

Link to comment
Share on other sites

You get that error because that image is not yet loaded, you see the loader is there to load that image ;)

 

I would suggest you to use Data URI's on loader images, example:

var dataURI = 'data:YourDataURI';var sprite = new game.Sprite(game.Texture.fromImage(dataURI));

Online Data URI converter:

http://websemantics.co.uk/online_tools/image_to_data_uri_convertor/

 

In Panda.js 1.3.0 you can easily change loader logo with:

game.Loader.logo = 'MyLogoDataURI';
Link to comment
Share on other sites

Hello again,

 

Still encountering problems. I'm trying to add clouds going from left to right. So, I added this function in 'scenes.js':

addCloudLeftToRight: function(x, y, path, speed) {var cloudlefttoright = new CloudLeftToRight(x, y, path, {speed: speed});this.addObject(cloudlefttoright);this.stage.addChild(cloudlefttoright);}

And this in 'objects.js':

CloudLeftToRight = game.Sprite.extend({update: function() {this.position.x += this.speed * game.scene.cloudSpeedFactor * game.system.delta;if(this.position.x + this.width > 900) this.position.x = -200;}});

Yesterday, with Panda.js 1.2.0, it was working. Today, with Panda.js 1.3.1, I got this error:

 

"Uncaught TypeError: Cannot read property 'hasLoaded' of undefined" 

Link to comment
Share on other sites

  • 1 month later...

Hi:

   I define a new classs as 

Panda = game.Sprite.extend({    path:'meida/panda.png',    interactive: true});

then I add the class to stage

var sprite, text;sprite = new Panda(game.system.width / 2,game.height / 2 - 100);this.stage.addChild(sprite);

browser catch this error:

TypeError: texture.baseTexture is undefined
 
  if(texture.baseTexture.hasLoaded)

 

 

So how can I fixed this issue,thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...