How to edit a Sprite Animation with an base64 coded image?

For developers using the Construct 2 Javascript SDK

Post » Sat May 24, 2014 3:21 pm

How can I load a base 64 encoded image into a sprite animation frame from code?
Last edited by darkstar on Sun May 25, 2014 1:00 pm, edited 1 time in total.
B
7
S
2
G
1
Posts: 24
Reputation: 1,277

Post » Sat May 24, 2014 5:11 pm

Copy, and paste, or ajax file loaded as lastdata into "load image from url".
Can't really recommend the first.
Remember that frame must exist, and the animation be on that particular frame. Speed should probably be 0 at that point as well.
Also that texture will replace that frame in any other instances of the same sprite.
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Sun May 25, 2014 1:00 pm

how do i access the object from code?

Say my sprite is named LargeImages?

I'm just making this up... but how do i access the animation frame object from code? to Update the image in the frame to another image?

For example, could it be something like this:

this.somthing.largeimage[2].src...
B
7
S
2
G
1
Posts: 24
Reputation: 1,277

Post » Sun May 25, 2014 2:28 pm

Where are you editing code at?
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Sun May 25, 2014 7:16 pm

From a javascript piece of code. Either in a script tag or from one plugin trying to interact with a sprite
B
7
S
2
G
1
Posts: 24
Reputation: 1,277

Post » Sun May 25, 2014 10:37 pm

Still not sure what you are trying to do.
Since the sprite object already has that functionality, you could take a look at the existing code.
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Mon May 26, 2014 12:15 am

I have a new base64 image that I'm trying to replace one of the sprite image frames with. But I don't know how to access the sprite object in code to replace the frame. @ashley any ideas how I can do this?
B
7
S
2
G
1
Posts: 24
Reputation: 1,277

Post » Thu Jun 26, 2014 5:18 am

With the help of JavaScript, you need to edit some code. As the images are available in that scripting language. See an example how to edit it at sitewired.
B
2
Posts: 1
Reputation: 152


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests