Austin Kottke's Code Site

Thoughts about Architecture – Java, C/C++, JS, Objective-C, Swift, Groovy, Grails, (RIP Flash)
Archive for February, 2007

One thing which I found in dealing with all of the flash 8 and flex projects is that in translations for styling of CSS and XML – I’ve found a pretty effective way to do this so that in projects you can have a stylesheet applied with variable font sizes and XML being parsed at the same time. It starts out with the fact that you have a TextLoader class which loads in the text similar to: public static function loadText( aStyleSheetPath:String, anInterfaceDir:String ):Void { Logger.log(“INFO”, TextLoader.toString() + ” loading stylesheets and text.”); var styleSheetDir:String = aStyleSheetPath; var interfaceDir:String = anInterfaceDir; var currentLanguage:String = LanguageManager.getLanguage(); var cssFilePath:String = styleSheetDir + “stylesheet_” + currentLanguage + “.css” ; var xmlFilePath:String = interfaceDir + “interface_” +currentLanguage+”.xml”; /*——————————————————————— * Now we load in the stylesheet and once it is loaded we can then * get the current interface and load this. *———————————————————————*/ var stylesheet:TextField.StyleSheet = new TextField.StyleSheet(); stylesheet.load( cssFilePath ); stylesheet.onLoad = Delegate.create(TextLoader, function( status ) { /*——————————————————————— * Once the stylesheet is loaded we then apply this to the text and * then get it applied and the text loaded. *———————————————————————*/ var interfaceTextXml:XML = new XML(); interfaceTextXml.ignoreWhite = true; interfaceTextXml.load( xmlFilePath ); interfaceTextXml.onLoad = Delegate.create(TextLoader, function( isLoaded:Boolean ) { if( isLoaded ) { Logger.log(“INFO”, TextLoader.toString() + “Interface XML loaded [“+ xmlFilePath+”] ” ); Logger.log(“INFO”, TextLoader.toString() + “StyleSheet CSS loaded [“+cssFilePath+”] ” ); TextLoader.initialize(interfaceTextXml, stylesheet); TextLoader.notifyListeners( new TextLoadedEvent() ); } else { Logger.log(“ERROR”, TextLoader.toString() + “Unable to load xml [“+xmlFilePath+”] ” ); } }); }); } This then loads…

There is a new article from the blitz agency on how to use papervision with 3dsmax to skin properly. Check out the article here Please follow and like us:0