[Behavior] Inject base64 string as Sprite Image

Post your completed addons to share with the community

Post » Tue Apr 10, 2012 9:05 am

@Pode I have a strange issue.
On iPad (and mind only on iPad) the plugin doesn't work. I load the image on an event and unless the user touch a part of the screen the image doesn't get injected. Do you have any idea about why this could happen? I think it's for the way I'm resizing the screen is this a possibility?

Thanks
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Tue Apr 10, 2012 1:06 pm

@Pode I found the culprit for reasons unknown this never fires:

this.inst.cur_animation.frames[this.inst.cur_frame].texture_img.onload

until the user touch the screen (and even then is unpredictable) do you know why? Is there any way to forse the loading?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Tue Apr 10, 2012 4:43 pm

@Mulkaccino : it's easy ! For example, in the demo I posted in the original post, you can, in one of the two textboxes, paste the URL of an image, and click on "Inject", and voil !.

@0plus1: it's strange. I didn't heard of any particular quirk or bug from the iOS Webkit build with the onload() event. I'm going to check that tomorrow. If it's a bug, I'm going to try a false 'click' event to resolve that.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Apr 11, 2012 3:38 pm

@Pode, don't worry about that because it's probably an issue with the simulator.

Instead, your plugin on both android/iphone when the aspect ration changes from the original one it fires an error in this line of the engine:

ctx.drawImage(cur_image, myx, myy, this.width, this.height);

do you have any idea of why?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Thu Apr 12, 2012 9:42 am

@0plus1: I suppose that when the ratio aspect changes, it invalidates the width/height values. I'm going to add a check before, to rewrite those values based on the new aspect ratio.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Thu Apr 12, 2012 9:47 am

Thanks, if you point me in the right direction maybe I can do it myself otherwise let me know when you are ready, it's the last piece missing from my application.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 13, 2012 3:01 am

Hi, Pode

Thanks for this behavior, it is very usefull to me too, but I am having some issues here, let me explain. I am using a sprite with 2048x1431 and when I try your behavior in my PC, with win7 64bits, it only works in Opera, nor in Chrome and Firefox. When I try it in Safari, in my iPad 2, it works ok. This is normal or there are some thinks to let it work in Chrome and firefox too.

Thanks
B
90
S
5
G
8
Posts: 164
Reputation: 7,646

Post » Sat Apr 14, 2012 9:06 am

@Pode, there is an issue with your pluging, read here apparently the injected sprite is missing width and height?
If you can help me fix this error I'm more than willing to pay you for your work.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Mon Apr 16, 2012 2:02 pm

@0plus1 : I posted a new build in the first post.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Apr 18, 2012 9:59 am

@Pode sorry but it still do not work. I ended up making one myself check here: http://www.scirra.com/forum/topic51261_post323173.html#323173.
The way I did it is the only way, and as far as my knowledge goes you can't do it in a behaviour.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests