Reference name of sprite or layer

For developers using the Construct 2 Javascript SDK

Post » Fri Feb 12, 2016 11:03 pm

I have a sprite called "Tank" on "Layer 0"
Trying to reference the name of a sprite or a layer with javascript.
Do these elements have ID's like <div id="Layer 0"> or <img id="Tank" scr......>

First time delving into SDK so go easy on me :!:
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Sat Feb 13, 2016 4:35 am

Take a look at the sdk section of the manual. Specifacally the runtime reference. You can get a layer by name so that helps, but you can't get a type by name. The usual method is to use a object type parameter for an action or something. Then you can get a reference to that object like that.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Sat Feb 13, 2016 4:36 am

Type name will be minify after exported.
B
108
S
26
G
260
Posts: 4,435
Reputation: 146,193

Post » Mon Feb 15, 2016 12:48 am

Thanks, I obviously need to do some major reading on this.
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Mon Feb 15, 2016 12:12 pm

The only thing in the engine that are DOM elements are the form controls. Everything else is pure JS rendering to a canvas. So there are no div, img or any other kind of elements at all for those things.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,454


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests