Accessing a sprite after exporting for Windows 8

For developers using the Construct 2 Javascript SDK

Post » Tue Oct 09, 2012 5:24 am

Hi!

I need to access the file behind a Sprite object after exporting for Windows 8.

If I have a plugin action which takes an argument as Object and I invoke it with a sprite object, I am able to obtain the file name for that sprite with the following code:

Is this a reliable way to get the file name backing the sprite object?

var inst = objectImage.getFirstPicked();
if (!inst || !inst.curFrame)
   return;
var imgLocation = inst.curFrame.texture_file; // returns images\filename0.png
B
18
S
7
G
5
Posts: 71
Reputation: 4,991

Post » Wed Oct 10, 2012 3:55 am

Hi!
@Ashley or someone else, can you please help me with this?
B
18
S
7
G
5
Posts: 71
Reputation: 4,991

Post » Wed Oct 10, 2012 9:57 am

I think it would be more reliable to use inst.curFrame.texture_img.src. You will have to deal with automatic spritesheeting though - one image may contain many animation frames.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Oct 10, 2012 6:09 pm

@Ashley, thanks for the reply. I as concerned about the automatic spritesheet too.

Is there a way to instruct the C2 engine not to do that for specific sprites? (For example setting a property in the sprite?)
B
18
S
7
G
5
Posts: 71
Reputation: 4,991


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests