Tokens in Haxe build process? - actionscript

I'm using Haxe to make a few simple SWFs for RTMP video streaming. Everything is working great, but what I'd really like to do is tokenize a few properties so that the SWFs are compiled with environment specific properties ALA Ant.
E.G:
var host = "rtmp://localhost:1935/broadcasts";
Becomes:
var host = "#RTMP_ADDRESS#"
And then during compile, the token is substituted with an environment specific value- local.properties contains:
RTMP_ADDRESS=rtmp://localhost:1935/broadcasts
I've poked around in documentation and on forum posts and can't see how to do this, though I'm sure it's possible. Can anyone point me in the right direction?
Note: I considered using flashvars and managing the address in the web application, but that seems less efficient. If that's the better way to handle this please explain why.

It sounds a perfect case to use macros, which is in the nightly build of haxe.
You can create a config file (maybe in xml format) inside your project, and in the body of your macro function you load the file and extract the String, finally return it as an expression.

Related

MAMP/WAMP - Switch back from real project URLs to localhost in all my files

Good morning,
does anyone know how I could configure MAMP (or WAMP) in order to automatically change my project URLs, to localhost without having to search/replace inside my documents (operation I suppose to be a bit gross because possibly altering my code).
My goal is to develop on local while keeping the final and real URLs in my documents.I suppose lot of you have encountered this issue one day :)
In other word, I would like to alternate between online and local more easily.
I a beginner, please consider,
for all the biginners, here's the thing. I've created a config.php file which contains constants: one config file for the local project folder and one for the online server folder.
Inside this config file, I've create a constant (constant are then available everywhere in the project) to define the main URL of the project. e.g.:
define('CST_MAIN_URL',http://www.myproject.com); // for the online config.php file
define('CST_MAIN_URL',http://localhost:8888); // for the local config.php file
Thus, each header or redirection can work with that constant, like:
header('location:' . CST_MAIN_URL . 'index.php');
Then, things must have to do with RewriteEngine in your htaccess file, for instance whenever you must modify the behavior of MAMP/WAMP if an interrogation point or a slash provokes you with its malicious resistance. But, unfortunately RegEx expression must be understood as a basic level for mastering those url rewritings.
Hope it'll helps.

Saxon CE 1.1 - Using result-document to create a output file

I've been playing with Saxon-CE_1.1 over the last few days and have managed to create a little application that allows users to classify pictures according to a data dictionary using a select dialog. All was going really well until I tried to use the result-document() function in it's "classic" way, to create a new file in the file system containing the choices the user has made.
XML Quire is returing with a severe error stating:
XpathException in mode: '{http:saxonica.com/ns/interactiveXSLT}onclick' event: [object MouseEvent]: Expected '?select=' ir '#' at start of result document href found "filename.xml
This error seems, to me, to be stating that I must pipe the results back into the HTML using # or ?select/
Is it still possible to create "external" output using SaxonCE? If so how can I accomplish the task.
Until recently it has not been possible to read or write files in the local client machine from Javascript code running in the browser, and if Javascript can't do it, then Saxon-CE can't do it either.
This may change soon with the HTML5 FileSystem API, but as far as I'm aware support for this is still very patchy. When it appears to be more stable and widespread, we can certainly look at implementing both doc() and xsl:result-document to access local filestore (or indeed, implementing the EXPath file module).

gnugettext base directory for Delphi XE2

I am evaluating gnugettext for Delphi XE2. All seems to be OK except that it seems that we don't have translation directory(ies) choice : it is always "\locale\Lc_MESSAGES\".
As I need to share translation for some exe in the same application it's not very convenient. I looked in the sources and see :
BaseDirectory:=ExtractFilePath(ExecutableFilename);
OK, I may change the source but I don't like it.
Any elegant idea ?
You can use the provided bindtextdomain function to change the directory where your application looks for the dictionary files. The first parameter will normally be the string 'default', and the second parameter is the directory to go to. The actual dictionary files will still need to be in a subfolder of the specified directory (using the same \locale\LC_MESSAGES\ pattern), but this at least gives a convenient way of sharing translations across multiple programs.

Using LuaDoc with extensions other than .lua

I am currently developing lua scripts for a new application which requires the extension to be xx_lua. I have luadoc working fine for .lua extensions and I know I could simply rename the files to the lua extension create the documents and rename them back, but personally I would prefer a more elegant solution.
Is is possible to get luadoc to look at other extensions. I have tried calling
luadoc_start *.xx_lua
but that results with no output even when there are plenty of files in the path with that extension.
If modifying luadoc is an option then you can do that. I just had a quick look at the 3.0.1 version (latest at the moment of writing this) and in src/luadoc/taglet/standard.lua there's line 406:
local patterns = { "%.lua$", "%.luadoc$" }
The pattern "%.lua" is used at two other locations (same file, line 316) and in src/luadoc/doclet/html.lua:53, that last one doesn't seem relevant. The right thing to do in my opinion would be to create a global parameter for filename extension and use it instead of the hardcoded ".lua". Maybe you can even submit a patch to luadoc and improve it for future programmers in your situation :)

Customizable / Dynamic SWF generation

Wondered if anybody knows how customizable Flash swf files are made, where there appears to be a template swf that the user can then input some changes (eg text or image) and receives a newly-compiled swf file with their changes.
Some examples:
- http://flashfreezer.com/landingconfetti/index.html
Constraints:
- user receives a single output swf file that can be played with all their changes included. ie there is no reading from an xml file, or using Flashvars.
Been trying different things for a few weeks with no luck!
There are a number of ways, but generally the most common is to either use a SWF generating library (like PHP's) or through server-side compiling.
Normally, this will be a custom or proprietary library which uses the same language that the serve is running (and there are open-source libraries for this in PHP, Perl, Python, Java, C++... etc). The SWF is generated and served up with the appropriate headers so that the browser knows how to re-direct it. Often this will involve a pre-defined template which is then modified slightly for the new input. Only occasionally does this involve the manipulation of pre-generated SWF directly.
The other option is to have a command line call to the Flash IDE or the Flex compiler (and, technically, this can work for CS3 and CS4, though in a very nasty and hackish way) to generate a new version of the SWF on the fly. This is often slower, but it will generally yield a more finished feel to a product.
You could try Swiffotron. It can modify SWF files and do text replace type things on both text elements and in compiled actionscript.
Here's a swiffotron xml job file that does some text replacing.
And here's a swiffotron XML job file that modifies instances on the stage.
I didn't check the site, but the only way I can think of is to read the requirement details through flash (this can be done through plain html also) and then generate the AS files from their templates and compile them at the server side (using mxmlc or other compilers) and give back the SWF.
I get the impression that you're looking for SwfMill. SwfMill creates a swf based on an XML file that you create/define. You could use SwfMill on the server to generate a swf based on user input.

Resources