Let's say that I want all my programs under a flex project to go to a new url, with the name of the program's html and swf as variables. Now, normally, it's going to hardcode Foo.mxml to a URL of:
file:///local/wherever/project/bin-debug/Foo.html
But I want it to go to:
http://localhost/elsewhere/?a=Foo.html?b=Foo.swf
N开发者_高级运维ow, I can do this in a hardcoded way by editing Foo.mxml to be the above, but then I have to do the same for Bar.mxml and Baz.mxml. I really want to be able to do (something like) this:
http://localhost/elsewhere/?a=${html}&b=${swf}
And have it fill in the result for me. Then either set that as "the default" somehow, or at least make just one run-debug-setting and reuse it as needed. Any thoughts?
Update:
To clarify, the point isn't specifically to pass in "a" and "b" - yes I can use flash variables or other things. The issue is that I want my own "default" setting that takes the name of the project into account, because the default 'file:///' URL is not appropriate.
Also, yes, I'm using Flex Builder 4.
Are you using Flash Builder? The Command line tools? Or some other IDE?
In Flash Builder, you need to create a 'run' profile for each main application file. I'm not sure how to apply Macros / Variables in that situation. It is a one to one relationship between application and the run profile.
You can use some variables in the HTML template files, though, but off the top of my head I don't i know the complete list of the ones available [and couldn't find a list in Adobe documentation].
Pass them in as Flash vars.
精彩评论