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
89
S
30
G
95
Posts: 5,154
Reputation: 63,444

Post » Sat Feb 13, 2016 4:36 am

Type name will be minify after exported.
B
107
S
25
G
242
Posts: 4,387
Reputation: 136,966

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
383
S
224
G
86
Posts: 24,117
Reputation: 190,432


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests