Jump to content

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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