2011/09/21

To Add Icon at Anywhere Under TWaver Flex Network Element

iconAttachment mechanism of Java can place many icons or characters at anywhere under network element, check the following picture please.
The function of icon can be displayed on the network element by the following method under Flex:

1server1.setStyle(Styles.ICONS_NAMES, ["att5","att6", "att7","att8"]);
2server1.setStyle(Styles.ICONS_POSITION, Consts.POSITION_BOTTOMRIGHT_TOPRIGHT);
3server1.setStyle(Styles.ICONS_ORIENTATION, Consts.ORIENTATION_TOP);
4server1.setStyle(Styles.ICONS_XOFFSET, 5);
Default realization does not provide icon addition function for multiple positions.
But it will be easier to extend this function by FlexMVC design which is very flexible, please check picture as below:
Create more iconAttachment to display the icons on different places by Attachment mechanism of TWaver.
Code download
private function getIconsSize(names:Array, orientation:String, xgap:Number, ygap:Number):Size
override public function draw(graphics:Graphics):void

If you are interested, you can try to realize the attachment with different places and position
You can achieve by modifying the following two methods of CustomIconAttachment:

How to convert TWaver Flex to TWaver AIR Demo quickly

TWaver Flex Demo is constructed and released by Flex, many customers want to experience the running result of AIR. FlashBuilder4.* has enhanced a new function of Changing Flex projects to Adobe AIR projects, so that TWaver Flex can be converted to TWaver AIR Demo faster.

This conversion is easy , there is only thing to do is to shield some functions of right-click popup menu on DemoUtils.as Code,  take contextMenu.hideBuiltInItems() for example , this function is not supported in AIR, besides, remember to click item of Use Flex3 compatibility mode on Flex  Compiler. To emphasize again that TWaver Demo is written based on Flex3, but twaver.swc absolutely support for Flex4 SDK development, and combination of Spark as well. The following pictures are for your reference.

2011/08/25

To Check the Cover Rate of Flex Code by FlexCover


During the development, you can check whether there are“wasted “code in the current codes or not through FlexCover toolkit as below
1 ) Download FlexCover-SDK, http://code.google.com/p/flexcover/;

2Install CoverageViewer.air;


3)Copy one piece of sdk. Take version 4.1 for example: download sdk-modifications-4_0 and copy to sdk to cover the existing files.




4Add the modified SDK to Flash Builder;




5Set the current SDK as copySDK;



6Find one *.cvm file under the catalog of bin-debugit means the setting has been done;



7Run CoverageViewer to load the generated cvm document;


8Run the demo to check the cover rate;