Copy link to clipboard
Copied
Hi hope some one can help me with this.
Im trying to include an .as file but i want the path to that file to have a variable.
public var folderpath:String = "english"
include "F:/folder/folder" + folderpath + "/file.as"
is there a way to do this?
Thx pavel
1 Correct answer
Include is a compile time directive, you can't use actionscript (which runs after compilation) to affect it.
However, you can use conditional compilation. I can imagine this making sense when you have tons of files at different places and wat to be able to switch between them.
You can define compile time constants in Publish Settings -> ActionScript 3.0 Settings -> Config Constants -> Add as much constants as you need, in this case:
CONFIG::ENGLISH true
CONFIG::GERMAN false
...CONFIG::ENGLISH fu
Copy link to clipboard
Copied
Include is a compile time directive, you can't use actionscript (which runs after compilation) to affect it.
However, you can use conditional compilation. I can imagine this making sense when you have tons of files at different places and wat to be able to switch between them.
You can define compile time constants in Publish Settings -> ActionScript 3.0 Settings -> Config Constants -> Add as much constants as you need, in this case:
CONFIG::ENGLISH true
CONFIG::GERMAN false
CONFIG::ENGLISH function init() { include "en/file.as"; }
CONFIG::GERMAN function init() { include "de/file.as"; }
init();
Result: "en/file.as" gets included.
Conditional compilation enables you to define multiple function or class definitions and with setting the Config constant, you get different results.
Copy link to clipboard
Copied
Hey Peter,
Thank for the reply sorry that I took forever to get back to this. I really appriciate your help
thx pavel

