Jump to content

Goodboy example .js doesnt work on Chrome ?


vmars316
 Share

Recommended Posts

I ran it in both pixi 1  and  pixi 3 . Same results .

http://www.goodboydigital.com/pixijs/example_1_basics.zip 

 

This much , without the sprite , works fine :

<!DOCTYPE HTML><html><head><title>pixi.js example 1</title><style>body {margin: 0;padding: 0;background-color: #000000;}</style><script src="pixi.js"></script></head><body><script>// create an new instance of a pixi stagevar stage = new PIXI.Stage(0x66FF99);// create a renderer instance.var renderer = PIXI.autoDetectRenderer(400, 300);// add the renderer view element to the DOMdocument.body.appendChild(renderer.view);requestAnimFrame( animate );function animate() {requestAnimFrame( animate );// render the stagerenderer.render(stage);}</script></body></html>
 

But the full code , just shows a black screen: 

<!DOCTYPE HTML><html><head><title>pixi.js example 1</title><style>body {margin: 0;padding: 0;background-color: #000000;}</style><script src="pixi.js"></script></head><body><script>// create an new instance of a pixi stagevar stage = new PIXI.Stage(0x66FF99);// create a renderer instancevar renderer = PIXI.autoDetectRenderer(400, 300);// add the renderer view element to the DOMdocument.body.appendChild(renderer.view);requestAnimFrame( animate );// create a texture from an image pathvar texture = PIXI.Texture.fromImage("bunny.png");// create a new Sprite using the texturevar bunny = new PIXI.Sprite(texture);// center the sprites anchor pointbunny.anchor.x = 0.5;bunny.anchor.y = 0.5;// move the sprite t the center of the screenbunny.position.x = 200;bunny.position.y = 150;stage.addChild(bunny);function animate() {   requestAnimFrame( animate );   // just for fun, lets rotate mr rabbit a little   bunny.rotation += 0.1;   // render the stage      renderer.render(stage);}</script></body></html>

Can you aim me at a Tutorial ?

 

Thanks

Link to comment
Share on other sites

And the errors in the console say? I'd suspect it's unable to load the bunny.png for some reason. Perhaps you're opening the file directly instead of via a local httpd server?

Console , oh , i see what you mean here:

Chrome:

Failed to load resource: net::ERR_FILE_NOT_FOUND
09_movingSprites.html:9 Uncaught ReferenceError: PIXI is not defined
 
IE:
HTML1300: Navigation occurred.
09_movingSprites.html
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
09_movingSprites.html
SCRIPT5009: 'PIXI' is undefined
09_movingSprites.html (9,1)
 
Thanks..
Link to comment
Share on other sites

Well , I have made some headway: 

 

When i changed this:

<script src="../pixi.js/bin/pixi.js">
 
to this:
<script src="C:\pixi.js\bin\pixi.js">
 
and changed this: 
images/cat.png
 
to this"
file:///C:/pixi.jslearningPixi-masterexamples/images/cat.png
 
Things got somewhat better .
 
But still having probs (different probs) , so i'll Post a new message .
 
..vm
Link to comment
Share on other sites

Same thing here as another post.  Start a new project in a new  folder.  The only file in that folder is your index.html.  Then make two folders a "js" folder and an "assets" folder.  Put the pixi.js in the "js" folder.  Now your path will be "js/pixi.js".  That is a relative path so you can just copy the folder and paste it on your server.  If you use the absolute path with C: whatever, it won't work when you paste it onto your server folder anymore.

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...