vihanagarwal Posted February 17, 2017 Share Posted February 17, 2017 I am having a really weird issue. I am creating a sprite from an image as follows: var grid1_texture = new PIXI.Texture.fromImage("whiteSquare.jpg"); Now this works fine and I am able to add this to the stage. I basically want to add all my images to a folder called resources. So I changed the code to this: var grid1_texture = new PIXI.Texture.fromImage("/resources/whiteSquare.jpg"); When I do this, I can see in Brackets editor that the link is being made however, the sprites do not get rendered on the stage. Please help! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 17, 2017 Share Posted February 17, 2017 that's an absolute link? I don't know the structure of your app in web server, try relative link? var grid1_texture = new PIXI.Texture.fromImage("resources/whiteSquare.jpg"); Quote Link to comment Share on other sites More sharing options...
ClusterAtlas Posted February 17, 2017 Share Posted February 17, 2017 I myself usually append a "./", ie: fromImage("./resources/whiteSquare.jpg"), try it out too. Quote Link to comment Share on other sites More sharing options...
xerver Posted February 17, 2017 Share Posted February 17, 2017 Remember these are URLs, not file paths. Quote Link to comment Share on other sites More sharing options...
vihanagarwal Posted February 17, 2017 Author Share Posted February 17, 2017 I fixed it. For some reason changing "/resources/..." to "resources/..." made it work. I'm quite confused why Quote Link to comment Share on other sites More sharing options...
xerver Posted February 17, 2017 Share Posted February 17, 2017 Because they are different urls, one is "root domain -> resources -> ..." the other is "current url -> resources -> ...". ClusterAtlas 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.