| LowRA API Documentation | Annexes | All Packages | All Classes | Index | Frames |
|
| lowRA Assembler URL rules | ||
You will find below the various methods to define url for all loadeable elements defined in the xml application context file for LowRA IoC.
URL can be defined for nodes <dll>, <rsc> and display object node in the display tree.
<bean>
<dll url="myDLL.swf" />
<rsc id="style" url="styles.css" />
<root id="root"> <sprite id="logo" url="assets/logo.swf" /> </root>
</bean>
In classic way, all url are relative to the application container ( html container in most of cases ), but it is possible to manage url with LowRA features too.
LowRA support Flashvars definition to group externals files into dedicated folders.
The IoC engine manage 5 flashvars definition for external files definition.
Flashvars can be defined in html container ( or direcly using URL query ).
Example of a simple html container (using swfobject )
<script type="text/javascript">
var flashvars = {};
flashvars.config = "config/";
flashvars.context = "applicationContext.xml";
flashvars.dll = "dll/";
flashvars.gfx = "content/";
flashvars.resource = "resources/";
var params = {};
params.allowFullScreen = "false";
params.allowscriptaccess = "always";
var attributes = {};
attributes.id = "ds";
attributes.styleclass = "container";
swfobject.embedSWF( "assembler.swf", "flashContent", "960", "600", "9.0.115", "dll/expressInstall.swf", flashvars, params, attributes );
</script>
Automatically, when flashvars are defined, all files's url are prefixed with passed-in path.
So here, we load the config/applicationContext.xml file as main xml file.
All ddls file should be contained in a folder named dll, resources on resources folder and ...
Better organization of files and more, it is possible to swtich content changing only the flashvars value.
Note : if no Flashvars are defined, url still relative to the html container.
As Flashvars definition support URL Query, it is possible to overwrite Flashvars defined in html container with new values using url query.
So, we can change many things at runtime without changing the html container, neither the application context file too.
Example :
http://www.mysite.com?context=applicationContext-test.xml&dll=dll-demo&resources=fr
context, dll flashvars are overwritten with new values.
But now... "If I want to change only one dll url ? I can't because all dlls are now prefixed with flashvars.dll path value ?"
Of course you can..., if url is absolute, prefix is not added and if you want to define a real relative path without the prefix system, you can use the "Forced relative" definition.
All files are correctly organized into folder, Flashvars are configured, but you want a "special case" for a dll, resource or graphic file ?
Forced relative definition is what you want.
To keep the "classic" relative definition, just prefix url with a #//
Loading engine will ignore Flashvars prefix if this keyword is present.
<bean>
<dll url="myDLL.swf" /> <!-- use Flashvars definition --> <dll url="#//myTestDLL.swf" /> <!-- keep real relative path -->
</bean>
Note : It is possible to change the keyword value.
Default is #//, but if want to change it, you have to modify the application assembler and recompile it.
In code, juste set the new value for keyword like this :
DefaultDisplayObjectBuilder.RELATIVE_PATH = "myKeyword";