Sprite LoadImage from URL is working wrong...

Bugs will be moved here once resolved.

Post » Wed Jan 16, 2013 7:04 pm

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 www.something.com

Expected: Images must be different

Link below is my testing capx.

https://www.dropbox.com/s/d1dmzfpfqsg5kg5/test.capx

Is this bug..??
How do I solve this probplem..??
B
11
S
2
Posts: 73
Reputation: 1,438

Post » Wed Jan 16, 2013 7:53 pm

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.ranma2013-01-16 19:54:32
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Wed Jan 16, 2013 8:12 pm

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

B
11
S
2
Posts: 73
Reputation: 1,438

Post » Thu Jan 17, 2013 1:34 am

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Thu Jan 17, 2013 7:16 am

@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
B
11
S
2
Posts: 73
Reputation: 1,438

Post » Thu Jan 17, 2013 11:33 am

first change frame, then load frame from url mate :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Fri Jan 18, 2013 8:14 am

@ranma
I followed your guideline but result have no changed...:(
Here my capx
https://www.dropbox.com/s/2yak3j892nb0v72/test2.capx

Could you pls give me a sample capx to solve this problem...:)hoanganh172013-01-18 08:15:53
B
11
S
2
Posts: 73
Reputation: 1,438

Post » Fri Jan 18, 2013 11:10 am

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
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Fri Jan 18, 2013 11:12 am

@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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Fri Jan 18, 2013 3:48 pm

@Ashley...
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...:)..???


I still believe that the sprite have no redraw function after image is loaded already...???. I guess...

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

Thank to0 much for your replyhoanganh172013-01-18 16:06:06
B
11
S
2
Posts: 73
Reputation: 1,438

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest