Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

AS3: Include AS file plz help!

Explorer ,
Oct 25, 2011 Oct 25, 2011

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

TOPICS
ActionScript
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Oct 29, 2011 Oct 29, 2011

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

...
Translate
Enthusiast ,
Oct 29, 2011 Oct 29, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2011 Nov 02, 2011
LATEST

Hey Peter,

Thank for the reply sorry that I took forever to get back to this. I really appriciate your help

thx pavel

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines