Sprite LoadImage from URL is working wrong...

0 favourites
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I am looking for solution to load Image from URL in run time but actually when using LoadImage from URL action of Sprite with different links...I have same Image ...???

    Step of reproduce here:

    System->OnStartLayout: Load image from URL ...."www.something.com"

    Button->OnClick: Create Sprite then Load image from URL ...."www.somethingelse.com"

    Result: Both image same from something.com

    Expected: Images must be different

    Link below is my testing capx.

    dropbox.com/s/d1dmzfpfqsg5kg5/test.capx

    Is this bug..??

    How do I solve this probplem..??

  • same sprite = same texture = load from url into all sprites. not a bug. experiment with multiple frames as frames don't share textures ie:

    System->OnStartLayout: Load image from URL ...."www.something.com"

    Button->OnClick: Create Sprite, set frame 1, load image from URL ...."www.somethingelse.com"

    keep in mind that frame numbers are 0 based and you have to actually have 2 frames (zero frame and frame one) in that sprite - they can be blank as you will load from url to them later on.

  • Thank ranma

    I do it follow your suggestion but problem still there..same image for instances of sprite after i add action sprit->set animation frame to 1..

    Actually after do a test (I add browser alert Sprite.AnimationFrameCount)

    AnimationFrameCount==1 this is meaning that there are no more frame for sprite after loading..

    I think sprite cannot redraw it self after image loaded already.

    Have you got some other way to walkthrough

    Thank in advance..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This is by design: to save memory all Sprites share their images, so loading one sprite's image from a URL will update all sprites. If you want to use different images, add 10 or so empty animation frames, then you can load a different image in to each frame.

  • Ashley thank so much for your reply

    But actually after I add more empty frame to sprite, the second instance of sprite after invoke LoadImage form URL and set frame to 1 have a blank image...

    Problem is not solved..

    Best regards

  • first change frame, then load frame from url mate :)

  • ranma

    I followed your guideline but result have no changed...:(

    Here my capx

    dropbox.com/s/2yak3j892nb0v72/test2.capx

    Could you pls give me a sample capx to solve this problem...:)

  • it doesnt seem to load second image at all, it shows the second frame of the sprite correctly, but the "load from url" doesnt seem to fire.

    I think this may be a bug, Ashley

  • hoanganh17 - in that .capx it doesn't work because the server you are loading from does not give you permission to load it. Check the browser error console.

  • No, I don't think so

    1. You can see second image in case you post it's url in browser.

    2. If I change image ure (ie "http://www.psdgraphics.com/wp-content/uploads/2009/12/color-wheel.jpg"). The result is same (blank).

    3. In my browser have no error message on firebug...:)..???

    <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" />

    I still believe that the sprite have no redraw function after image is loaded already...???. I guess... <img src="smileys/smiley4.gif" border="0" align="middle" /> <img src="smileys/smiley4.gif" border="0" align="middle" />

    I did try this test many time with different image's url but same..

    Thank to0 much for your reply

  • hoanganh17 - viewing an image in a browser is not the same as requesting it from a different web page. Many servers allow you to view images directly in a browser, but not request it from a different page (e.g. to avoid hotlinking or trying to steal content).

    Use this tool to check what permission the server gives:

    http://web-sniffer.net/

    The first URL you try to load is this one:

    i478.photobucket.com/albums/rr143/jennette79/baby_angel.jpg

    The server responds with:

    Access-Control-Allow-Origin:     *

    This means "you are allowed to use this image". This is because photobucket are OK with you using their images on other sites.

    Try your other image URL:

    psdgraphics.com/wp-content/uploads/2009/12/color-wheel.jpg

    The server does not respond with any "Access-Control-Allow-Origin" header. This means "you are not allowed to use this image", and the image fails to load. This is the default setting for most servers, or indicates the author of the site does not want you to use their images on other sites.

    So this is still not a bug, you need to make sure you have permission to access the images you want.

    Note in Chrome's console it returns an error message whenever you try to load an image you don't have permission for - I don't know why Firebug doesn't though.

  • Thank you ASHLEY.

    You give me very clear explanation.

    I will do a test again in my own server and give you a result tomorrow..

    Best regards

  • Thank you Ashley

    In case of "Access-Control-Allow-Origin" existed..function load Image from URL is working well.

    You are my captain

    Best regards

  • Hi

    I am having the same issue. I have a hosting plan with HostGator.

    I wanted to ask how you solved the problem?

    Is this a problem of the hosting company, or do I need to do some configuration in the html of the page?

    I really appreciate your help.

  • Me too, i use 000webhost i don't have the permission to re use my own files.

    Should i ask them ? Can i do it by miself ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)