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
85
S
27
G
85
Posts: 5,070
Reputation: 57,874

Post » Sat Feb 13, 2016 4:36 am

Type name will be minify after exported.
B
107
S
25
G
225
Posts: 4,326
Reputation: 128,331

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
378
S
220
G
84
Posts: 23,871
Reputation: 188,157


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 2 guests