Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
CCB does not let but define global variables?

cmaiia
Registered User
Quote
2024-05-14 22:29:05

I can't but declare global varivals in this way:

var data;
behavior_move_to = function () {
data = this
}

What happened to version 6 does not allow?


Guest
Guest
Quote
2024-05-15 06:58:07

You can't but declare virival if not version 6 allow no this way but declare.

var varival;

behavior_move_from = function () {
varival = this / Math.PI * varival
}

htisd hope help varival


okeoke
Registered User
Quote
2024-05-15 07:08:11

You can do it with CopperCube. I would say you should not do it, because it looks like a programming war crime, but it works. You can then access behavior instance context using data variable.

It's the same as the following code which you can run in browser console:
var obj;

var F = function () {
this.x = 10;
obj = this;
}

new F();

console.log(obj);

Probably, it's a good idea to read more about JS context if it doesn't work as you expect, for example here:https://medium.com/swlh/understa...


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact