Textfield substitution:
Currently all our textfields are dynamic and contain references to an xml node:
ie "pages.home.title"
<pages><home><title textFormat="myFormat">My title</title></home></pages>
These textFields are wrapped in a TextLoader classes. This class dispatches a TextLoaderEvent through stage.loaderInfo.sharedEvents. A TextManager class in the main.swf receives these events and substitutes the textFields with one that contains the right copy and formatting.
The testFormat links to another xml which contains attributes for the font, size, color etc.
<format textFormat="myFormat" font="myFont" size="20"... />
Currently I am looking to replace this with a robotlegs solution...
The robotlegs context maps all TextFields to a mediator: mediatorMap.mapView(TextField, TextFieldMediator);
The mediator replaces the TextField with one with the correct copy. NB the new textField will instantiate a new
TextFieldMediator so if the xml copy cannot be located (as it has already been replaced) then the textField should not be replaced and the Mediator should deactivated / removed itself.
Exclude settings:
Our main.swf is also published as a swc into a library. This swc is linked in the libraries of loaded swfs with the linkage option of exclude. (In flash click on the linked library and change settings from merged to exclude). All common classes across the project are referenced in a MainShared class linked to the Main class of the main.swf.
public class Main extends MovieClip
{
public function Main(){
MainShared
}
}
public class MainShared
{
public function
MainShared (){
TextLoader
TextManager
TLFTextField
SharedClassA
SharedClassB
}
}
NB we do not instantiate these classes just reference them so they get compiled into the main.swf and swc. Loaded swfs will compile with the exclude setting so the classes are not duplicated in loaded swfs. When publishing a loaded swf it may seem as if it has failed to publish correctly as classes it is expecting are not there, but if loaded through the main.swf then the excluded classes will be available to it.
Preloader:
Not looked at that yet. If main.swf has the reference then all loaded swfs can use the preloaded classes. Then you will only need a preloade in main. I thnk?!
Ben