The document discusses various ways to optimize Flex applications for performance, including:
1. Using runtime shared libraries (RSLs) to externalize shared assets and reduce SWF file size.
2. Optimizing object creation by delaying it until necessary or staggering creation.
3. Improving measurement and layout performance by reducing nested containers and using Box containers when possible.
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Flex_rest_optimization
1. Flex with Rest and Optimazation MyLabs Flex with Rest and Optimazation
2. Ways between AJAX and Flex using the flashVars properties, querying string parameters, using the navigateToURL() method using the ExternalInterface class
6. Using URL fragments <mx:Script> <![CDATA[ import mx.managers.BrowserManager; import mx.managers.IBrowserManager; import mx.utils.URLUtil; private var bm:IBrowserManager; [Bindable] private var fName:String; [Bindable] private var lName:String; private function init(e:Event):void { bm = BrowserManager.getInstance(); bm.init("", "Welcome!"); /* The following code will parse a URL that passes firstName and lastName as query string parameters after the "#" sign; for example: http://www.mydomain.com/MyApp.html#firstName=Nick&lastName=Danger */ var o:Object = URLUtil.stringToObject(bm.fragment, "&"); fName = o.firstName; lName = o.lastName; } ]]> </mx:Script>
7.
8.
9.
10. Using the ExternalInterface API Access javascript from flex <![CDATA[ import mx.controls.Alert; private function init():void { var userAgent:String = ExternalInterface.call("navigator.userAgent.toString"); Alert.show(userAgent, "navigator.userAgent:"); } ]]> </mx:Script> <mx:ApplicationControlBar dock="true"> <mx:Button label="Display user agent" click="init();" /> </mx:ApplicationControlBar>
11. Using the ExternalInterface API Access flex from javascript public function myFunc(s:String):void { // whatever you want} public function initApp():void { ExternalInterface.addCallback("myFlexFunction",myFunc); } <SCRIPT LANGUAGE="JavaScript"> function callApp() { window.document.title = document.getElementById("newTitle").value; mySwf.myFlexFunction(window.document.title); } </SCRIPT>
20. Measurement/Layout: Definition The process of assigning a position and size to every component <mx:Application> <mx:HBox> <mx:Button label=“1”/> <mx:Button label=“2”/> </mx:HBox> <mx:TextArea width=“100%” height=“100%” text=“Text”/> </mx:Application>