开发者

Can't find how to use CONFIG:: directives properly

Let's say I have to compile two different versions of my .swf for different sites. The difference is in hostnames for the ajax and redirection, several minor tweaks in code and in graphics added to the project in .swc. I can switch different swcs easily, but the code tweaks are hard to manage easily. I've got

CONFIG::site1 
{
    private var _domainName:String = "site1.com";
}

CONFIG::site2
{
    private var _domainName:String = "site2.com";
}

FB brings up an error: 1151: A conflict exists with definition _domainName in namespace internal.

What I need is smthn like this in C:

#ifdef SITE1
char hostname[] = "site1";
#endif

#ifdef SITE2
char hostname[] = "site2";
#endif

Is there any way to use compile directives that way usi开发者_C百科ng mxmlc?

P.S. Everything works now


I think this documentation will help you.

In your case it is something like the following:

private var _domainName:String = NAMES::site;

And mxmlc arguments will look like:

-define+=NAMES::site,"'site1.com'"


You could do this :

private var _domainName:String = CONFIG::site1 ? "site1.com" : "site2.com";

If you want to know what's possible with configuration constants have a look at this page :
http://wiki.ecmascript.org/doku.php?id=proposals:program_configuration
So far I've found that the compiler support everything mentioned on this page.


Why code the domains at all? Not a directive or specifically an answer to your question I'm just saying lol

private var _domainName:String;

var lc:LocalConnection = new Local
this._domainName= lc.domain;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜