Upload
jeya-soft
View
853
Download
1
Embed Size (px)
Citation preview
Why flash 4.5?
S.JeyaSekar MCA ., Mphil
Software Engineer
Aavanor Systems
Chennai.
Developing mobile and multiscreen applications
Accelerated coding for Flex and ActionScript projects
Improved designer/developer workflow
Updated platform support and improved performance
Startup module, local cache and storage, Externalizing skins and assets
20% faster for compilation65% faster for large projects
Loading style sheets at run timeThree-step process:
Write a CSS file for your application.
Compile the CSS file into a SWF file.
Call the styleManager.loadStyleDeclarations() method in your application.
This method loads the CSS-based SWF file into your application.
Reducing SWF file sizes
Larger SWF files take longer to unpack in Flash Player.
Using the bytecode optimizer
The bytecode optimizer can reduce the size of the application’s SWF file by using bytecode merging and peephole optimization
Peephole optimization removes redundant instructions from the bytecode.
In Flash Builder or the mxmlc command-line compiler, you can set the optimize compiler option to true
mxmlc -optimize=true MyApp.mxml
Disabling debugging Disabling debugging can make your SWF files smaller.
When debugging is enabled, the Flex compilers include line numbers and other navigational information in the SWF file
To disable debugging when using the command-line compiler, set the debug compiler option to false.
The default value for the compc compiler is true.
Externalizing assets Advantage:
reducing the SWF file size is to externalize assets;
To load the assets at run time rather than embed them at compile time. You can do this with assets such as images, SWF files, and sound files.
Disadvantage: (Embedded assets )
It add to the size of your application and slow down the application initialization process
Advantage:
Embedded assets load immediately, because they are already part of the Flex SWF file.
Optimizing Performance
Keep some facts in the back of your mind when developing.
Prioritize on what to optimize based on how the user sees it.
ActionScript Tips
Minimize work in constructor, static initializers as they are not JITed.
Use int or uint instead of Number where appropriate (promotion).
If type is known, cast before using it.
Writing to local var is 15x faster than class var.
Minimize access to getter/setter, loop counter, etc.
• Use shift operators instead of multiply/divide by powers of 2.
• int main() {if ((1*2) == (1 << 1))
printf("you certainly can!\n");else
printf("doesn't work that way\n");}
bitwise operatorsshiftn<<p left
shift shifts the bits of n left p positions. Zero bits are shifted into the low-order positions. 3 << 2 is 12.
n>>p right shift
shifts the bits of n right p positions. If n is a 2's complement signed number, the sign bit is shifted into the high-order positions. 5 >> 2 is 1.
Use strongly typed code. Make methods final.
Clear and re-use arrays – arr.length = 0;
Cast to int is faster than Math.floor()
• Use Vector instead of Array
When reading elements:
Vector is 40% faster than Array on Windows
Vector is 60% faster than Array on Mac
• When writing elements, Vector is 140 – 160% faster than Array !
Deletion is expensive (about 20x slower then reading or writing)
It’s cheaper to write NaN, null, or -1 instead of deleting the element
Difference between Vector and ArrayList:
1)Vector is synchronized therefore it is thread safe while ArrayList is not.
2)Vector can increment the size by double while arraylist can increment it by 50%.
3)Vector is legacy class while ArrayList is newly added.
4)Default ArrayList capacity is 0 where as Vector intial
capacity is 10.out vector and examples
http://www.mikechambers.com/blog/2008/09/24/actioscript-3-vector-array-performance-comparison/
Array < ArrayList < ArrayCollection.
Event Dispatching
Use custom event name in [Bindable] for better performance. (so that you can optimize dispatching in setter).
Item Renderers
• Use ActionScript renderers for max scroll performance.
•MXML renderers are slower: Data binding
o Extra containers
o States
o Layout
o Heavier base class
New classes in 4.5
• StyleableTextField
o Lightweight text, no effects, some style support.
• BitmapImage
o Lightweight image.
• ContentCache
o Cache images so that they don’t flash when scrolling.
For Web - Modules and RSLs Split application into different modules.
o Because big applications take a lot of time to download
o Compile parts of your application into SWFs that are loaded at runtime.
o Load each module when you need it.
o This will improve perceived startup time
Runtime Shared Libraries:
o Used to share code between *different* Flex applications
o Loads before application starts, startup time penalized if RSL not in browser cache already
o Adobe signed RSLs (SWZ) like the Flex framework stored in special player cache
Optimizing Size
Embedded assets.
Fonts should have character ranges
Avoid memory leaks (remove listeners)
Avoid fragmentation (big object instead of lots of small objects)
Code faster
Code generation
Use QuickAssist/Fix to rename and manipulate variables, generate getters/setters and event handlers, organize imports, and more.
Use the override/implements feature to define methods from a superclass or interface.
Refactoring and ASDoc support
Quickly navigate through code or restructuring by renaming all references to a class, method, or variable.
Display comments in MXML and ActionScript editors using ASDoc.
Code templates
Use over 100 new best-practice code templates (aka snippets) for ActionScript, MXML, and CSS. Review and insert templates using code assist. Create custom templates and import or export them for sharing within teams.
More productivity, more power
Accelerate coding and testing of Flex and ActionScript projects using extensive new and improved tooling features.
Large project development
Improved large-application performance
See up to a 65% reduction for refactoring operations on projects with a large number of dependent libraries, a significant reduction in memory used when profiling complex applications, and improved profiler responsiveness.
Command-line build
Use the command-line build capability to automate your build process.
Expanded platform support
Updated platform support
Take advantage of new platform support for Eclipse™ 3.6 (Helios) and the standard Eclipse for Java™ distribution; the Cocoa version of Eclipse on Mac OS X; and Adobe Flash Player 10.1, Adobe AIR 2.5, and Flex SDK 4.5.
Interactive data visualization
Create data dashboards and interactive data analysis by dragging and dropping a chart type and linking it to a data source. Use the powerful Advanced Datagrid to enable users to explore complex data.
Rich expressive experiences
Create more intuitive, engaging applications to help people understand and use data to support key business activities, leading to increased levels of productivity and effectiveness.