加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

工作中的Flex总结

发布时间:2020-12-15 05:13:25 所属栏目:百科 来源:网络整理
导读:2011-11-14 1. HTTPService var?service:HTTPService?=?new?HTTPService();? _service.url?=? "http://121.194.117.200:8080/monitorSystem/dataAction_getFlexValue.action" ;? _service.method?=? "POST" ;???? _service.addEventListener( "result" ,?htt
2011-11-14
1. HTTPService
 
 
  1. var?service:HTTPService?=?new?HTTPService();?
  2. _service.url?=?"http://121.194.117.200:8080/monitorSystem/dataAction_getFlexValue.action";?
  3. _service.method?=?"POST";????
  4. _service.addEventListener("result",?httpResult);????
  5. _service.addEventListener("fault",?httpFault);?
  6. _Service.send(param);?
  7. function?httpResult(event:ResultEvent):void??
  8. {??
  9. ????Alert.show(_service.lastResult);?
  10. }?
  11. ?????
  12. function?httpFault(event:FaultEvent):void??
  13. {????
  14. ????var?faultstring:String?=?event.fault.faultString;????
  15. ????Alert.show("Fault:?"?+?faultstring);????
  16. }??? ??
2. as3获取js地址参数
as3代码:
 
 
  1. var?_str:String?=?ExternalInterface.call("getType");?
  2. trace(_str);?
js代码:
 
 
  1. <script?type="text/javascript">?
  2. ????function?Request()?
  3. ????{?
  4. ????????var?strHref?=?window.document.location.href;?
  5. ????????var?intPos?=?strHref.indexOf("?");?
  6. ????????if(intPos?==?-1)?
  7. ????????{?
  8. ????????????return?"";?
  9. ????????}?
  10. ????????var?strRight?=?strHref.substr(intPos?+?1);?
  11. ????????return?strRight;?
  12. ????}?
  13. ?
  14. ????function?getType()?
  15. ????{?
  16. ????????return?Request();?
  17. ????}?
  18. </script>?
3. js调用as3中的方法
as3 代码:
 
 
  1. if(ExternalInterface.available)?
  2. {?
  3. ????ExternalInterface.addCallback("getDataStart",getDataStart);?
  4. }?
  5. ?
  6. function?getDataStart(id:String?=?""):void?
  7. {?
  8. ????Alert.show("id?=?"?+?id,?"start");?
  9. }?
Js代码:
 
 
  1. <script?type="text/javascript">?
  2. ????function?sendStart()?
  3. ????{?
  4. ????????//?customDemo指嵌入的swf的id?
  5. ????????customDemo.getDataStart("xxxx");?
  6. ????}?
  7. </script>?
4. Json
 
 
  1. import?com.adobe.serialization.json.*;?
  2. ?
  3. var?_obj:Object?=?JSON.decode(value);?
  4. var?_str:String?=?JSON.encode(value);?
5. LineChart横坐标倾斜45°
css中:
 
 
  1. @font-face??
  2. {??
  3. ????font-family:?EmbeddedArial;??
  4. ????src:?url("simkai.ttf");?
  5. ????embedAsCFF:?false;?
  6. }??
  7. ?
  8. .LineChart?
  9. {??
  10. ????fontFamily:EmbeddedArial;??
  11. }?
Flex中:
 
 
  1. <mx:LineChart?id="linechart"?seriesFilters="[]"?styleName="LineChart"?
  2. ??????????showDataTips="true"?dataProvider="{_DataArr}">?
  3. ?
  4. ????<mx:horizontalAxis>?
  5. ????????<mx:CategoryAxis?id="dateAxis"?categoryField="x"/>?
  6. ????</mx:horizontalAxis>?
  7. ?
  8. ????<mx:horizontalAxisRenderers>??
  9. ????????<mx:AxisRenderer?labelRotation="45"?axis="{dateAxis}"/>??
  10. ????</mx:horizontalAxisRenderers>??
  11. ?
  12. </mx:LineChart>?
6. Flex4 中 旋转特效
 
 
  1. <fx:Declarations>?
  2. ????<s:Rotate?id="rotateEffect"?/>?
  3. </fx:Declarations>?
  4. ?
  5. function?changeAngle():void?
  6. {?
  7. ????rotateEffect.angleFrom?=?0;?
  8. ????rotateEffect.angleTo?=?100;?
  9. ????rotateEffect.autoCenterTransform?=?false;?
  10. ????rotateEffect.transformX?=?5;?
  11. ????rotateEffect.transformY?=?7;?
  12. ????rotateEffect.play([poiner]);?
  13. }?
?
2011-12-6
?
1. BlazeDS
配置BlazeDS

?
Flex代码
 
 
  1. public?function?submsg():void?
  2. {?
  3. ????var?consumer:Consumer?=?new?Consumer();?
  4. ????consumer.destination?=?"tick-data-feed";?
  5. ????consumer.subtopic?=?xml.main;?
  6. ????consumer.channelSet?=?new?ChannelSet(["my-streaming-amf"]);?
  7. ????consumer.addEventListener(MessageEvent.MESSAGE,?messageHandler);?
  8. ????consumer.subscribe();?
  9. }?
  10. ?
  11. private?function?messageHandler(event:MessageEvent):void??
  12. {?
  13. }?
2. 点击Legend隐藏显示线条
 
 
  1. <mx:Legend?x="865"?
  2. ????y="11"?
  3. ????dataProvider="{linechart1}"?
  4. ????color="0x323232"??
  5. ????itemClick="itemClickHandler(event)"?
  6. ????buttonMode="true"/>?
  7. ?
  8. private?function?itemClickHandler(event:LegendMouseEvent):void?
  9. {?
  10. ????event.item.element.visible?=?!event.item.element.visible;?
  11. }?
3. 限定charts的上下限
 
 
  1. <mx:verticalAxis>?
  2. ????<mx:LinearAxis?minimum="0"??maximum="100"/>??
  3. </mx:verticalAxis>?
4. 在LineChart中画网格
 
 
  1. <mx:backgroundElements>????
  2. ????<mx:GridLines?gridDirection="both">????
  3. ????????<mx:verticalStroke>????
  4. ????????????<s:SolidColorStroke?color="black"?weight="0.5"?alpha="0.2"?/>????
  5. ????????</mx:verticalStroke>????
  6. ????</mx:GridLines>????
  7. </mx:backgroundElements>?
5. 自定义鼠标
 
 
  1. [Embed(source="assets/mouse.swf")]?
  2. private?var?mouseIcon:Class;?
  3. ?
  4. CursorManager.setCursor(mouseIcon,2,-33,-65);?
  5. ?
  6. //移除自定义鼠标形状?
  7. CursorManager.removeAllCursors();?
6. Vslider
 
 
  1. <s:VSlider?id="vslider"??
  2. ????change="changePosition()"?
  3. ????dataTipFormatFunction="vsliderDataTipFunction"??
  4. ????maximum="3"??
  5. ????minimum="0"?
  6. ????value="0"/>?
  7. ?
  8. private?function?vsliderDataTipFunction(value:Number):Object?
  9. {?
  10. ????var?_str:String;?
  11. ?????
  12. ????return?_str;?
  13. }?
  14. ?
  15. private?function?changePosition():void?
  16. {?
  17. }?
7. Charts特效
 
 
  1. <mx:SeriesInterpolate?id="rearange"/>????
  2. <mx:SeriesSlide?id="slide"/>????
  3. ?
  4. var?_columnService:ColumnSeries?=?new?ColumnSeries();?
  5. _columnService.setStyle("showDataEffect",rearange);?
  6. _columnService.setStyle("hideDataEffect",null);?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读