views:

35

answers:

2

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

Now, 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.

A: 

Pass them in as Flash vars.

Gregor Kiddie
A: 

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].

www.Flextras.com
@flextras: thanks - a good discussion of the index template file can be found [here](http://www.kylehayes.info/2007/03/05/Flex-HtmlTemplate-filetype-to-CFM-instead-of-HTML/) with a list of macros [here](http://www.morearty.com/blog/2007/01/24/macros-that-are-available-in-html-template-files/). i _can_ assign one run setting to multiple applications, so i'm just looking to reuse here...
eruciform
I guess I'm confused at what you're trying to accomplish, and what tools you're using to do it.
www.Flextras.com
@flextras: there are a bunch of applications that i want to change their run/testing url to something else than the hardcoded default, but i don't want to edit every single one, since the pattern is simple, just like the original default, but with an ever-so-slightly different path...
eruciform
Back to my original question. Are you using Flash Builder? Or a command line tiil? Or an IDE? I'll add; is this a production thing, or a development thing? If it is a development issue, I'll go back to my original answer, that each debug profile can only have a single app. If it's a production thing, using a server side language, such as PHP, to generate your URLs.
www.Flextras.com
@flextras: flex builder 4. it just looks silly to need to rewrite every single one if i want `http://xxx/Foo.html` instead of `file:///yyy/Foo.html`. isn't there a way to override what the "default url" is (or the way the default is structured)?
eruciform
I you're using the default URL, you can just change the output folder URL in the project properties on the Flex Build Path tab. If you want to use manual URLs, then yes you have to change them manually.
www.Flextras.com