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
100
S
38
G
134
Posts: 5,556
Reputation: 85,325

Post » Sat Feb 13, 2016 4:36 am

Type name will be minify after exported.
Goodbye
B
114
S
31
G
295
Posts: 4,549
Reputation: 164,608

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
414
S
245
G
92
Posts: 25,205
Reputation: 200,351


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest