this.layout returns undefined?

For developers using the Construct 2 Javascript SDK

Post » Sat Apr 19, 2014 7:21 am

When I access this.layout object in instance's onCreate function, it return undefined instead of the current layout. Am I missing anything?
B
23
S
9
G
3
Posts: 114
Reputation: 3,794

Post » Sat Apr 19, 2014 2:32 pm

Why would you expect it to work? That is not a property set on instances. Only the layer is set, and you can get the layout from the layer.
Scirra Founder
B
403
S
238
G
89
Posts: 24,659
Reputation: 196,165

Post » Sun Apr 20, 2014 3:06 am

But I've tried using this.runtime.running_layout, it returns null instead. Is there an event to get notified when the layer is created?
B
23
S
9
G
3
Posts: 114
Reputation: 3,794

Post » Sun Apr 20, 2014 1:25 pm

It depends when you check for the value and where from. Just look in Chrome's debugger to see what properties are there.
Scirra Founder
B
403
S
238
G
89
Posts: 24,659
Reputation: 196,165


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests