<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="init()">
<fx:Style> Application{
fontSize:12;
fontFamily:myFont;
}
</fx:Style>
<fx:Script> <![CDATA[
import com.twobowl.component.manualTopo.Nodes;
import com.twobowl.component.manualTopo.line.ILine;
import com.twobowl.component.manualTopo.main.TopoManager;
import com.twobowl.component.manualTopo.node.INode;
import com.twobowl.component.manualTopo.node.Node;
import com.twobowl.component.manualTopo.renderer.lineRenderer.ILineRenderer;
import com.twobowl.component.manualTopo.renderer.lineRenderer.SimpleLineRenderer;
import com.twobowl.component.manualTopo.renderer.nodeRenderer.SimpleNodeRenderer; import flash.utils.flash_proxy;
import flash.utils.getTimer; import mx.charts.renderers.LineRenderer;
import mx.collections.ArrayCollection;
import mx.collections.ArrayList;
import mx.collections.XMLListCollection;
import mx.containers.Panel;
import mx.controls.Alert;
import mx.core.Container;
import mx.core.DragSource;
import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.events.DragEvent;
import mx.events.ItemClickEvent;
import mx.managers.DragManager;
import mx.managers.PopUpManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
import mx.utils.ObjectUtil;
[Bindable]
private var manager:TopoManager;
[Bindable]
private var array:ArrayList;
[Bindable]
var data:ArrayCollection;
[Bindable]
var str:XML;
var lable:Panel=new Panel;;
var time:Timer;
private var isDragging:Boolean;//推断是否在拖动中的标志
//var isDoubleClick:Boolean = false;//推断是否是双击的标志 private function init():void{
time=new Timer(100);
time.addEventListener(TimerEvent.TIMER,mov);
remote.getXml();
manager=new TopoManager(); manager.drawSpace=drawSpace;
manager.createFromXML(xmldata);
//registerButton();
manager.status=TopoManager.S_NORMAL;
//registerButton();
drawSpace.doubleClickEnabled=true;
Alert.show(drawSpace.getChildren()[0].toString()); for each(var child:Object in drawSpace.getChildren()){
if( child instanceof SimpleLineRenderer){
(child as DisplayObject).addEventListener(MouseEvent.MOUSE_OVER,createLineWindow);
(child as DisplayObject).addEventListener(MouseEvent.MOUSE_OUT,removeLineWindow);
}else{ (child as DisplayObject).addEventListener(MouseEvent.MOUSE_DOWN, innerStartDragging,false,0,true);
(child as DisplayObject).addEventListener(MouseEvent.MOUSE_UP, innerStopDragging,false,0,true);
//(child as DisplayObject).addEventListener(MouseEvent.MOUSE_UP, click_stopDrag,false,0,true);
(child as DisplayObject).addEventListener(MouseEvent.DOUBLE_CLICK, doubleInnerStartDragging);
//(child as DisplayObject).addEventListener(MouseEvent.MOUSE_MOVE,createWindow);
//(child as DisplayObject).addEventListener(MouseEvent.MOUSE_DOWN, mouseDown_startDrag);
(child as DisplayObject).addEventListener(MouseEvent.CLICK, oneInnerStartDragging);
(child as DisplayObject).removeEventListener(MouseEvent.MOUSE_DOWN,addLine);
} }
}
//private function onOverHand(e:Event):void{ //} public var firstWindow:FirstWindow = new FirstWindow();
public var linetWindow:LineRender = new LineRender();
//使用组件对象打开弹出式窗体的最大优点是能够重用组件并保持所以的状态值.
private function createWindow(e:MouseEvent):void
{
firstWindow.addEventListener("pop",getWindowData);
PopUpManager.addPopUp(firstWindow, this, false);
PopUpManager.centerPopUp(firstWindow);
windowInnerStartDragging(e); }
private function getWindowData(e:Event):void
{
createNodeforward(e);
//Alert.show(firstWindow.logs);
//Alert.show(firstWindow.labelPosition.selectedItem.toString());
//Alert.show("color:" + firstWindow.labelColor.selectedColor);
} private function createLineWindow(e:MouseEvent):void
{
//firstWindow.addEventListener("pop",getLineWindowData);
//PopUpManager.addPopUp(linetWindow, this, false);
//PopUpManager.centerPopUp(linetWindow);
//windowLineStartDragging(e);
//Alert.show(e.currentTarget.toString());
//e.currentTarget.lineColor="0xCC336";
lable.x=this.mouseX+5;
lable.y=this.mouseY+5;
//lable.width=100;
//lable.height=40; lable.title="wode"; PopUpManager.addPopUp(lable,this,false);
//time.start(); } //shubiao 窗体移动时间 //Timer监听函数
public function mov(ti:TimerEvent):void{
if(lable.x!=this.mouseX+5||lable.y!=this.mouseY+5)
lable.move(this.mouseX+5,this.mouseY+5); } public function removeLineWindow(e:MouseEvent):void{
//Alert.show("");
PopUpManager.removePopUp(lable); //time.stop();
}
private function getLineWindowData(e:Event):void
{
createNodeforward(e);
//Alert.show(firstWindow.logs);
//Alert.show(firstWindow.labelPosition.selectedItem.toString());
//Alert.show("color:" + firstWindow.labelColor.selectedColor);
} //private var openner:Object;
//private function createWindow(e:MouseEvent):void
//{
// openner = PopUpManager.createPopUp(this, FirstWindow, false);
// PopUpManager.centerPopUp(openner as IFlexDisplayObject);
// openner.setData(new Array("bobo", "huhu", "coco")); // //openner.addEventListener("pop",getWindowData2);
//
//private function getWindowData2(e:Event):void
//{
//Alert.show(openner.logs);
// Alert.show(openner.labelPosition.selectedItem.toString());
// Alert.show("color:" + openner.labelColor.selectedColor);
//}
//private function onMouseDown(event:MouseEvent):void{
//isDragging = false ; //bla bla bla~~
//for each(var child:Object in drawSpace.getChildren()){
// childs.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
//childs.addEventListener(MouseEvent.MOUSE_UP, innerStopDragging);
//}
//}
//private function onMouseMove(event:MouseEvent):void {
//isDragging = true ;
//bla bla bla~~
//innerStartDragging(event);
//} //private function onClick(event:MouseEvent):void {
//if (isDragging == false) {
//bla bla bla~
/// doubleInnerStartDragging(event);
//}
//}
private function getArraylistFromXMLList(data:XMLList):ArrayList
{
array=new ArrayList();
for(var i:int=0;i<data.length();i++)
{
var obj:Object=new Object();
for(var j:int=0;j<data[i].children().length();j++)
{
var dataColoum:String=data[i].children()[j].localName();
obj[dataColoum]=data[i].children()[j].toString(); }
array.addItem(obj);
}
return array;
} private function registerButton():void{
//itemSource1.addEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag);
//itemSource2.addEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag);
///itemSource3.addEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag);
//itemSource4.addEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag); //this.addEventListener(MouseEvent.MOUSE_UP,mouseUPHandle,false,0,true);
}
private function unregisterButton():void{
//itemSource1.removeEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag);
//itemSource2.removeEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag);
//itemSource3.removeEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag);
//itemSource4.removeEventListener(MouseEvent.MOUSE_DOWN,doItemSourceDrag); //this.addEventListener(MouseEvent.MOUSE_UP,mouseUPHandle,false,0,true);
}
public function doItemSourceDrag(event:MouseEvent):void{ //var dragItem:Image=ObjectUtil.copy(event.currentTarget) as Image;
//var dragInitiator:Image=Image(event.currentTarget); var ds:DragSource = new DragSource();
//ds.addData(dragInitiator, "itemSource");
//var dragProxy:Image=new Image();
//dragProxy.source=dragInitiator.source;
//dragProxy.width=dragInitiator.width;
//dragProxy.height=dragInitiator.height;
//DragManager.doDrag(dragInitiator, ds, event,dragProxy,0,0,1); } //var mySprite:Sprite = new Sprite(); //mySprite.addEventListener(MouseEvent.CLICK, onClick);
//mySprite.addEventListener(MouseEvent.DOUBLE_CLICK, onDoubleClick);
//private function onDoubleClick(event:MouseEvent):void {
// isDoubleClick = true;
//}
///private function onClick(event:MouseEvent):void {
//isDoubleClick = false;
//if (isDragging == false) {
//var timer:Timer = new Timer(260, 1);
//timer.start();//也就是说两次单击间隔在260毫秒之内的就被觉得是双击
//timer.addEventListener(TimerEvent.TIMER, function(evt:Event):void {
//Alert.show(isDoubleClick.toString());
//if(isDoubleClick){ // doubleInnerStartDragging(event);//调用双击响应函数
//}else{
// oneInnerStartDragging(event);//调用单击响应函数
//}
//});
//}//这边的clickOrDouble也能够写成匿名函数,把mouseEvent传进去
//}
//private function clickOrDouble(event:MouseEvent):void {
//if(isDoubleClick){
// doubleInnerStartDragging(event);//调用双击响应函数
//}else{
// oneInnerStartDragging(event);//调用单击响应函数
//}
//}
// Called when the user moves the drag proxy onto the drop target. private function dragEnterHandler(event:DragEvent):void { if (event.dragSource.hasFormat('itemSource')) {
var dropTarget:Canvas=Canvas(event.currentTarget);
// Accept the drop.
DragManager.acceptDragDrop(dropTarget);
} }
//加入node
private function dragDropHandler(event:DragEvent):void { var data:Object = event.dragSource.dataForFormat('itemSource');
var dragItem:SimpleNodeRenderer=new SimpleNodeRenderer();
//var dragItem:Image=new Image();
//dragItem.source=(data as Image).source;
//Canvas(event.currentTarget).addChild(dragItem);
var tData:XML=<node id="undifine" name="unknow" desc="unknow" x="200" y="600" imgUrl=""/>;
tData.@id=getTimer();
tData.@x=Canvas(event.currentTarget).mouseX;
tData.@y=Canvas(event.currentTarget).mouseY;
//tData.@imgUrl=(data as Image).source+"";;
//dragItem.data=data;
manager.createNode(tData,dragItem);
//dragItem.addEventListener(MouseEvent.MOUSE_DOWN, innerStartDragging);
//dragItem.addEventListener(MouseEvent.MOUSE_UP, innerStopDragging); }
// 按下鼠标按键时会调用此函数。 private function innerStartDragging(event:MouseEvent):void
{ var parent:Container=(event.currentTarget as UIComponent).parent as Container;
parent.removeChild(event.currentTarget as UIComponent);
parent.addChild(event.currentTarget as UIComponent); event.currentTarget.startDrag(); }
private function doubleInnerStartDragging(e:MouseEvent):void
{
//var remotes:RemoteObject = new RemoteObject();
//调用在J2EE端remoting-config.xml中配置的暴露出的类的名称 id
//Alert.show(e.currentTarget.data.message);非常重要 remote.destination = "service";
//调用J2EE端类中的方法
remote.getXmls();
//监听调用成功事件
remote.addEventListener(ResultEvent.RESULT,result);
//监听失败事件
remote.addEventListener(FaultEvent.FAULT,fault);
createWindow(e);
//var str:XML=new XML(remote.getXmls());
//trace(str.toString());
//var s:String=remote.getXmls();
//Alert.show(s);
//var xmlList:XMLListCollection = new XMLListCollection(str.children());
//data.source = xmlList.toArray();
//getArraylistFromXMLList(xmllist); //for(var i:int=0;i<data.length;i++){
//// var o:Object = data.getItemAt(i);
// trace(o["id"],o["source"],o["x"]);
//}
//event.currentTarget.startDrag(); }
private function oneInnerStartDragging(e:MouseEvent):void
{
//var remotes:RemoteObject = new RemoteObject();
//调用在J2EE端remoting-config.xml中配置的暴露出的类的名称 id
//Alert.show(e.currentTarget.data.id);
remote.destination = "service";
//调用J2EE端类中的方法
remote.getXmls();
//监听调用成功事件
remote.addEventListener(ResultEvent.RESULT,result);
//监听失败事件
remote.addEventListener(FaultEvent.FAULT,fault); //var str:XML=new XML(remote.getXmls());
//trace(str.toString());
//var s:String=remote.getXmls();
//Alert.show(s);
//var xmlList:XMLListCollection = new XMLListCollection(str.children());
//data.source = xmlList.toArray();
//getArraylistFromXMLList(xmllist); //for(var i:int=0;i<data.length;i++){
//// var o:Object = data.getItemAt(i);
// trace(o["id"],o["source"],o["x"]);
//}
//event.currentTarget.startDrag(); }
private function result(evt:ResultEvent):void{
//Alert.show(str);
str=new XML(evt.result.toString());
// var xmlList:XMLList=new XMLList();
//var xmlListCollection:XMLListCollection=new XMLListCollection();
// var provider:ArrayCollection;
//xmlList=str.elements("node");
//xmlListCollection.source=xmlList; //provider=new ArrayCollection(xmlListCollection.toArray());
//var str:XML=new XML(evt.result.toString());
//var xmlList:XMLListCollection = new XMLListCollection(str.children());
//data.source = xmlList.toArray();
//data=new ArrayCollection(xmlList.toArray());
//getArraylistFromXMLList(xmllist);
//for(var i:int=0;i<data.length;i++){
// var o:Object = data.getItemAt(i);
//trace(o["id"],o["source"],o["x"]);
//Alert.show(o["id"]);
//}
//Alert.show(xmlList.source);
} private function fault(evt:FaultEvent):void{
Alert.show("调用失败。");
} private function windowInnerStartDragging(e:MouseEvent):void
{ //var remotes:RemoteObject = new RemoteObject();
//调用在J2EE端remoting-config.xml中配置的暴露出的类的名称 id
remote.destination = "service";
//调用J2EE端类中的方法
remote.getXmls();
//监听调用成功事件
remote.addEventListener(ResultEvent.RESULT,windowresult);
//监听失败事件
remote.addEventListener(FaultEvent.FAULT,windowfault);
//var str:XML=new XML(remote.getXmls());
//trace(str.toString());
//var s:String=remote.getXmls();
//Alert.show(s);
//var xmlList:XMLListCollection = new XMLListCollection(str.children());
//data.source = xmlList.toArray();
//getArraylistFromXMLList(xmllist); //for(var i:int=0;i<data.length;i++){
//// var o:Object = data.getItemAt(i);
// trace(o["id"],o["source"],o["x"]);
//}
//event.currentTarget.startDrag(); } private function windowresult(evt:ResultEvent):void{
str=new XML(evt.result.toString());
firstWindow.setData(str);
} private function windowfault(evt:FaultEvent):void{
Alert.show("调用失败!");
}
private function windowLineStartDragging(e:MouseEvent):void
{ remote.destination = "service";
//调用J2EE端类中的方法
remote.getXmls();
//监听调用成功事件
remote.addEventListener(ResultEvent.RESULT,lineresult);
//监听失败事件
remote.addEventListener(FaultEvent.FAULT,linefault); } private function lineresult(evt:ResultEvent):void{
var strs :XML=new XML(evt.result.toString()); linetWindow.setData(strs);
} private function linefault(evt:FaultEvent):void{
Alert.show("调用失败! ");
}
// 松开鼠标按键时会调用此函数。 private function innerStopDragging(event:MouseEvent):void
{ manager.updateLineRendererForNodeUI(event.currentTarget as UIComponent);
event.currentTarget.stopDrag();
}
//暂时画线
private function doDrawLine(event:MouseEvent):void
{
var x:int =Canvas(event.currentTarget).mouseX;
var y:int =Canvas(event.currentTarget).mouseY;
var lineToPoint:Point=new Point(x,y);
curLine.freeDraw(lineFromPoint,lineToPoint);
}
private var lineFromPoint:Point;
private var fromNode:INode;
private var curLine:SimpleLineRenderer;
//加入一条线
private function addLine(event:MouseEvent):void{
if(curLine!=null){
curLine.parent.removeChild(curLine);
curLine=null;
} fromNode=manager.getNodeByUI(event.currentTarget as UIComponent);
if(fromNode){
for each(var child:Object in drawSpace.getChildren()){
if(child!=event.currentTarget){
(child as DisplayObject).addEventListener(MouseEvent.MOUSE_UP,completeDrawLine);
} }
curLine=new SimpleLineRenderer();
drawSpace.addChildAt(curLine,0);
var parent:Canvas=((event.currentTarget as UIComponent).parent) as Canvas;
var x:int =parent.mouseX;
var y:int =parent.mouseY;
lineFromPoint=new Point(x,y);
curLine.freeDraw(lineFromPoint,lineFromPoint);
drawSpace.addEventListener(MouseEvent.MOUSE_MOVE,doDrawLine,false,0,true);
drawSpace.addEventListener(MouseEvent.MOUSE_UP,stopDrawLineAndRemove,false,0,true);
} }
//完毕画线,正式加入一条边
private function completeDrawLine(event:MouseEvent):void{
var toNode:INode=manager.getNodeByUI(event.currentTarget as UIComponent); var tData:XML=<line id="" fromNode="" toNode=""/>;
tData.@id=getTimer();
tData.@fromNode=fromNode.data.@id;
tData.@toNode=toNode.data.@id; //dragItem.data=data;
var newLine:ILine=manager.createLine(tData,curLine);
newLine.viewRenderer.draw(newLine);
removeDrawLineListner();
}
//停止画线
private function stopDrawLineAndRemove(event:MouseEvent):void{
curLine.parent.removeChild(curLine);
removeDrawLineListner(); //curLine.clearDraw(); }
//停止画线监听
private function removeDrawLineListner():void{ drawSpace.removeEventListener(MouseEvent.MOUSE_MOVE,doDrawLine);
drawSpace.removeEventListener(MouseEvent.MOUSE_UP,stopDrawLineAndRemove);
for each(var child:Object in drawSpace.getChildren()){
(child as DisplayObject).removeEventListener(MouseEvent.MOUSE_UP,completeDrawLine); }
curLine=null; }
private function forward(event:MouseEvent):void{
var javaeyeUrl:URLRequest = new URLRequest("topic.html");
navigateToURL(javaeyeUrl);
}
private function createNodeforward(event:Event):void{
var javaeyeUrl:URLRequest = new URLRequest("createNode.html");
navigateToURL(javaeyeUrl);
}
private function forwardJianKong(event:MouseEvent):void{
var javaeyeUrl:URLRequest = new URLRequest("workPieChart.html");
navigateToURL(javaeyeUrl);
} ]]>
</fx:Script>
<fx:Declarations> <s:RemoteObject id="remote" destination="service" >
</s:RemoteObject>
<fx:XML id="xmldata" source="D://testNode.xml"/> </fx:Declarations> <s:BorderContainer width="100%" height="100%"> <s:VGroup x="0" y="0" width="953" height="598"> <s:Group width="100%" height="5%" >
<mx:LinkButton x="23" y="10" label="首页" click="forward(event)"/>
<mx:LinkButton x="138" y="10" label="监控图" paddingLeft="0" paddingRight="0" click="forwardJianKong(event)"/>
<mx:LinkButton x="234" y="10" label="页面"/>
</s:Group>
<s:HGroup width="100%" height="90%">
<s:Group width="100%" height="100%">
</s:Group>
<s:Group width="458" height="533">
<mx:Canvas id="drawSpace" x="-467" y="-1" width="100%" height="100%"
borderVisible="false" dragDrop="dragDropHandler(event);"
dragEnter="dragEnterHandler(event);" horizontalScrollPolicy="off"
verticalScrollPolicy="off"> </mx:Canvas>
<mx:AdvancedDataGrid id="adg1" borderStyle="none" designViewDataType="flat" sortExpertMode="true" sortableColumns="true" width="100%" height="100%">
<mx:dataProvider>
<mx:HierarchicalData id="hd" source="{str.node}"/>
</mx:dataProvider>
<mx:groupedColumns> <mx:AdvancedDataGridColumnGroup headerText="节点统计" >
<mx:AdvancedDataGridColumn headerText="序号 " dataField="@id"/>
<mx:AdvancedDataGridColumn headerText="节点名称" dataField="@source" /> <mx:AdvancedDataGridColumn headerText="提供数据" dataField="@x"/>
<mx:AdvancedDataGridColumn headerText="使用数据" dataField="@y"/>
</mx:AdvancedDataGridColumnGroup>
</mx:groupedColumns>
</mx:AdvancedDataGrid>
</s:Group>
</s:HGroup> </s:VGroup>
</s:BorderContainer> </s:Application>

版权声明:本文博主原创文章,博客,未经同意不得转载。

flex4 一些项目使用的技术的更多相关文章

  1. atitit 商业项目常用模块技术知识点 v3 qc29

    atitit 商业项目常用模块技术知识点 v3 qc29 条码二维码barcodebarcode 条码二维码qrcodeqrcode 条码二维码dm码生成与识别 条码二维码pdf147码 条码二维码z ...

  2. p2p网贷项目开发全过程技术详解,应用框架是ci2.2

    p2p网贷项目开发全过程技术详解,应用框架是ci2.2 很标准的mvc开发代码,代码也很简单,方便二次开发 这篇文章会不断更新

  3. 1-1 课程导学 & 1-2 项目需求分析,技术分解.

    1-1 课程导学 1-2 项目需求分析,技术分解. 要有一定的dart基础,了解安卓和ios的一些普通的开发

  4. 【SSM之旅】Spring+SpringMVC+MyBatis+Bootstrap整合基础篇(一)项目简介及技术选型相关介绍

    试水 一直想去搭建个自己的个人博客,苦于自己的技术有限,然后也个人也比较懒散.想动而不能动,想动而懒得动,就这么一直拖到了现在.总觉得应该把这几年来的所学总结一番,这样才能有所成长. 不知在何时,那就 ...

  5. Spring+SpringMVC+MyBatis+easyUI整合基础篇(一)项目简述及技术选型介绍

    作者:13GitHub:https://github.com/ZHENFENG13版权声明:本文为原创文章,未经允许不得转载. 萌芽阶段 很久之前就开始打算整理一下自己的技术博客了,由于各种原因(借口 ...

  6. vue项目使用websocket技术

    一.为什么需要websocket? 前端和后端的交互模式最常见的就是前端发数据请求,从后端拿到数据后展示到页面中.如果前端不做操作,后端不能主动向前端推送数据,这也是http协议的缺陷. 因此,一种新 ...

  7. CNBlog客户端--项目介绍以及技术选型

    项目背景 由于现在开始在博客园写博客,再加上我是android程序员!所以呢,就自然而然的想到自己开发一个自己认为"美"的客户端!!其实还有个原因就是最近我比较闲!!纯属自己给自己 ...

  8. Android项目中JNI技术生成并调用.so动态库实现详解

    生成 jni方式有两种:一种是通过SWIG从C++代码生成过度的java代码:另一种是通过javah的方式从java代码自动生成过度的C++代码.两种方式下的步骤流程正好相反. 第一种方式:由于需要配 ...

  9. 项目兼容ie8技术要点

    好久没有写博客了,因为最近公司项目要调ie8兼容,一直在忙这事,终于竣工了,跟大家分享下这老掉牙的浏览器是如何搞定的...本人新手一枚,欢迎大家指教 项目是使用的jeecg框架,后台使用的java,前 ...

随机推荐

  1. hive编程指南--employees表数据定义

    hive编程指南中有个employees表,默认的分隔符比較繁杂,编辑起来不太方便(普通编辑器编辑的控制字符^A等被当成字符串处理了,没有起到分隔符的作用). 收集的解决方式例如以下: http:// ...

  2. Queue 消息的发送与接收(PTP 消息传递模型)

    上篇博客写到了JMS两种消息模型(P2P.pub/sub)<JMS两种消息模型>.本篇博客通过一个实例来进一步了解P2P模型. Queue消息的发送与接收--PTP消息传递模型,样例: Q ...

  3. 二进制搜索方法C++通用执行

    算法很easy.直接附着到代码它 #include <iostream> using namespace std; template<typename T> int binar ...

  4. [Android]Button按下后修改背景图

    Button按下后修改背景图 错误做法:为Button添加OnTouch事件监听,根据ACTION_UP和ACTION_DOWN动作来修改Button的背景图 错误原因:从理论上讲,按钮按下修改背景色 ...

  5. [Cocos2d-x]节点的尺寸大小

    作为一个CCNode,本身没有大小而言,但是AddChild之后,便有了尺寸的概念. Cocos2d-x中对于一个节点的尺寸可以通过以下三个方法获取: CCSprite: getContentSize ...

  6. poj 3304(直线与线段相交)

    传送门:Segments 题意:线段在一个直线上的摄影相交 求求是否存在一条直线,使所有线段到这条直线的投影至少有一个交点 分析:可以在共同投影处作原直线的垂线,则该垂线与所有线段都相交<==& ...

  7. BZOJ 刷题记录 PART 6

    [BZOJ2709]水的二分加验证.可是好像被读入萎到了... [BZOJ3229]强大的算法见此.被机房的一堆大神"推荐".于是被坑了...写了一个下午... [BZOJ3631 ...

  8. hdu2063+hdu1083(最大匹配数)

    传送门:hdu2063过山车 #include <cstdio> #include <cstring> #include <string> #include < ...

  9. hdu 2451 Simple Addition Expression(数位DP )成败在于细节

    亚洲区域赛的题,简单的数位DP题,注重细节. 任何细节都有可能导致wa,所以没有绝对的水题. 把握好细节,此题便A. #include<stdio.h> __int64 getans(__ ...

  10. 我的Android学习之旅(转)

    去年大概在七月份的时候误打误撞接触了一阵子Android,之后由于工作时间比较忙,无暇顾及,九月份的时候自己空闲的时间比较多,公司相对来说加班情况没以前严重.开启了个人的Android学习之旅,初衷是 ...