<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas clipContent="false" doubleClickEnabled="true" doubleClick="SelectionManager.instance.selectNone()" xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="400" backgroundColor="#FFFFFF" backgroundAlpha="1.0" xmlns:view="be.vip.marchingantsdemo.view.*" xmlns:objecthandles="com.roguedevelopment.objecthandles.*">
<mx:Script>
<![CDATA[
import com.roguedevelopment.objecthandles.SelectionManager;
import com.roguedevelopment.objecthandles.ObjectHandleEvent;
import mx.utils.ObjectUtil;
import mx.controls.Label;
import mx.controls.Button;
import com.roguedevelopment.objecthandles.OHMouseCursors;
import com.roguedevelopment.objecthandles.ObjectHandles;
import mx.core.Application;
import mx.core.UIComponent;
private var selectionRect:Rectangle;
private var clickPoint:Point;
private var selection:Boolean=false;
private var selectionX:int=0;
private var selectionY:int=0;
private var isDragCanvas:Boolean=false;
private var selectMode:Boolean=false;
private var selectionWidth:int=10;
private var selectionHeight:int=10;
private var ctrlArray:Array=new Array();
[Bindable]
private var ctrlPressed:Boolean=false;
private function creationComplete_handler():void
{
this.addEventListener(MouseEvent.MOUSE_DOWN, startSelectionDrawing_handler);
this.addEventListener(MouseEvent.MOUSE_UP, stopSelectionDrawing_handler);
}
public function startSelectionDrawing_handler(evt:MouseEvent):void{
if(this.hasEventListener(MouseEvent.MOUSE_DOWN))
{
this.removeEventListener(MouseEvent.MOUSE_DOWN, startSelectionDrawing_handler);
}
if(selection==false)
{
selectionRect=new Rectangle();
selectionX=this.mouseX;
selectionY=this.mouseY;
selectionRect.x=this.mouseX;
selectionRect.y=this.mouseY;
selectionRect.width=1;
selectionRect.height=1;
//this.addChild(marchingAntsSelectionRect);
this.addEventListener(Event.ENTER_FRAME,updateSelection_handler);
if(this.hasEventListener(MouseEvent.MOUSE_UP))
{
this.removeEventListener(MouseEvent.MOUSE_UP, stopSelectionDrawing_handler);
}
this.addEventListener(MouseEvent.MOUSE_UP, stopSelectionDrawing_handler);
}
}
public function updateSelection_handler(event:Event):void{
selectionRect.width=this.mouseX-selectionRect.x;
selectionRect.height=this.mouseY-selectionRect.y;
marchingAntsSelectionRect.rect=selectionRect;
}
public var dragCanvas:OBHContainer=new OBHContainer();
public var swapRect:Rectangle;
public function stopSelectionDrawing_handler(evt:MouseEvent):void{
if(isDragCanvas&&this.contains(dragCanvas))
{
this.removeChild(dragCanvas);
isDragCanvas=false;
}
if(this.hasEventListener(MouseEvent.MOUSE_UP))
{
this.removeEventListener(MouseEvent.MOUSE_UP, stopSelectionDrawing_handler);
}
if(this.hasEventListener(Event.ENTER_FRAME))
{
this.removeEventListener(Event.ENTER_FRAME,updateSelection_handler);
}
swapRect=marchingAntsSelectionRect.rect;
marchingAntsSelectionRect.x=0;
marchingAntsSelectionRect.y=0;
marchingAntsSelectionRect.clear();
dragCanvas=new OBHContainer();
this.addChild(dragCanvas);
//dragCanvas.contextMenu=pageMenu1;
isDragCanvas=true;
dragCanvas.x=selectionX;
dragCanvas.y=selectionY;
dragCanvas.height=swapRect.height;
dragCanvas.width=swapRect.width;
/* dragCanvas.addEventListener(MouseEvent.MOUSE_DOWN,dragUpdateLocation);
dragCanvas.addEventListener(MouseEvent.MOUSE_UP,dropUpdateLocation); */
//dragCanvas.addEventListener(KeyboardEvent.KEY_DOWN,onPressDel);
dragCanvas.addEventListener(MouseEvent.DOUBLE_CLICK,clearSelection);
selectItems();
//selectionRect=null;
}
[Bindable]
public var _left:int=0;
[Bindable]
public var _right:int=0;
[Bindable]
public var _top:int=0;
[Bindable]
public var _bottom:int=0;
public function selectionResize(event:ObjectHandleEvent):void
{
if(dragCanvas.x<=_left)
{
dragCanvas.x=_left-1;
}
if(dragCanvas.y<=_top)
{
dragCanvas.y=_top-1;
}
if(dragCanvas.x+dragCanvas.width>this.width)
{
var diff:int=dragCanvas.x+dragCanvas.width-this.width;
diff=dragCanvas.width-diff;
dragCanvas.width=diff;
}
if(dragCanvas.y+dragCanvas.height>this.height)
{
var diff:int=dragCanvas.y+dragCanvas.height-this.height;
diff=dragCanvas.height-diff;
dragCanvas.height=diff;
}
selectionRect=new Rectangle(dragCanvas.x-3,dragCanvas.y-3,dragCanvas.width+3,dragCanvas.height+3);
selectionRect.x=dragCanvas.x-3;
selectionRect.y=dragCanvas.y-3;
selectionRect.width=dragCanvas.width+3;
selectionRect.height=dragCanvas.height+3;
selectedItemsArr=new Array();
for (var i:Number=0;i<this.numChildren;i++)
{
if(selectionRect.containsRect((this.getChildAt(i)).getRect(this)))
{
if(this.getChildAt(i).name=='test1')
{
this.getChildAt(i).filters=[new GlowFilter(0x8fcef6,0.7,2,2,2,1)];
var coordinates:Object=new Object();
coordinates.index=i;
coordinates.lock=(this.getChildAt(i) as ObjectHandles);
coordinates.x=this.getChildAt(i).x-dragCanvas.x;
coordinates.y=this.getChildAt(i).y-dragCanvas.y;
selectedItemsArr.push(coordinates);
}
}
else
{
this.getChildAt(i).filters=[];
trace('no object');
}
}
}
private var selectedItemsArr:Array=new Array();
public function selectItems():void
{
selectedItemsArr=new Array();
if(swapRect!=null)
{
selectionRect=swapRect;
for(var u:int=0;u<this.numChildren;u++)
{
if(selectionRect.intersects((this.getChildAt(u)).getRect(this)))
{
//if{this.getChildAt(u).name!="MAnt"}
selectionRect=selectionRect.union((this.getChildAt(u)).getRect(this));
}
}
if(selectionRect.width<0)
{
selectionRect.x=selectionRect.x+selectionRect.width;
selectionRect.width=selectionRect.width*-1;
}
if(selectionRect.height<0)
{
selectionRect.y=selectionRect.y+selectionRect.height;
selectionRect.height=selectionRect.height*-1;
}
dragCanvas.x=selectionRect.x;
dragCanvas.y=selectionRect.y;
dragCanvas.height=selectionRect.height;
dragCanvas.width=selectionRect.width;
for (var i:Number=0;i<this.numChildren;i++)
{
if(this.getChildAt(i).name=="test1")
{
if(this.getChildAt(i) as ObjectHandles)
{
this.getChildAt(i).filters=[new GlowFilter(0x8fcef6,0.7,2,2,2,1)];
var coordinates:Object=new Object();
coordinates.index=i;
coordinates.x=this.getChildAt(i).x-dragCanvas.x;
coordinates.y=this.getChildAt(i).y-dragCanvas.y;
selectedItemsArr.push(coordinates);
}
}
}
}
else
{
this.getChildAt(i).filters=[];
}
if(selectedItemsArr.length>0)
{
selection=true;
isDragCanvas=true;
stage.focus=dragCanvas;
this.removeEventListener(MouseEvent.MOUSE_DOWN,startSelectionDrawing_handler);
}
else if(selectedItemsArr.length<=0)
{
for (var i:Number=0;i<selectedItemsArr.length;i++)
{
if(this.getChildAt(selectedItemsArr[i].index).name=="test1")
{
(this.getChildAt(selectedItemsArr[i].index) as ObjectHandles).select();
}
this.getChildAt(selectedItemsArr[i].index).filters=[];
}
marchingAntsSelectionRect.clear();
marchingAntsSelectionRect.x=0;
marchingAntsSelectionRect.y=0;
selection=false;
selectedItemsArr=new Array();
if(isDragCanvas)
{
this.removeChild(dragCanvas);
isDragCanvas=false;
}
}
}
private var dev:int=0;
public function clear():void
{
dev=0;
for (var i:Number=0;i<selectedItemsArr.length;i++)
{
this.removeChild(this.getChildAt(selectedItemsArr[i].index-dev));
dev=dev+1;
}
selectedItemsArr=new Array();
clearControl();
selectionRect=null;
}
public function dragUpdateLocation(event:MouseEvent):void
{
dragCanvas.startDrag();
dragCanvas.addEventListener(MouseEvent.MOUSE_MOVE,updatePosition);
for (var i:Number=0;i<selectedItemsArr.length;i++)
{
this.getChildAt(selectedItemsArr[i].index).x=selectedItemsArr[i].x+dragCanvas.x;
this.getChildAt(selectedItemsArr[i].index).y=selectedItemsArr[i].y+dragCanvas.y;
}
stage.focus=dragCanvas;
dragCanvas.setFocus();
}
public function updatePosition(event:MouseEvent):void
{
for (var i:Number=0;i<selectedItemsArr.length;i++)
{
this.getChildAt(selectedItemsArr[i].index).x=selectedItemsArr[i].x+dragCanvas.x;
this.getChildAt(selectedItemsArr[i].index).y=selectedItemsArr[i].y+dragCanvas.y;
}
//stage.focus=dragCanvas;
//dragCanvas.setFocus();
}
public function dropUpdateLocation(event:MouseEvent):void
{
dragCanvas.stopDrag();
dragCanvas.removeEventListener(MouseEvent.MOUSE_MOVE,updatePosition);
for (var i:Number=0;i<selectedItemsArr.length;i++)
{
this.getChildAt(selectedItemsArr[i].index).x=selectedItemsArr[i].x+dragCanvas.x;
this.getChildAt(selectedItemsArr[i].index).y=selectedItemsArr[i].y+dragCanvas.y;
}
//stage.focus=dragCanvas;
//dragCanvas.setFocus();
}
private function clearControl():void
{
for (var i:Number=0;i<selectedItemsArr.length;i++)
{
this.getChildAt(selectedItemsArr[i].index).filters=[];
}
selectionRect=null;
selectedItemsArr=new Array();
selection=false;
if(isDragCanvas)
{
this.removeChild(dragCanvas);
isDragCanvas=false;
}
if(this.hasEventListener(MouseEvent.DOUBLE_CLICK))
{
this.removeEventListener(MouseEvent.DOUBLE_CLICK,clearSelection);
}
if(dragCanvas.hasEventListener(MouseEvent.DOUBLE_CLICK))
{
dragCanvas.removeEventListener(MouseEvent.DOUBLE_CLICK,clearSelection);
}
}
private function clearSelection(event:MouseEvent):void
{
clearControl();
//selectMode=false;
}
public function multiselectionevent(event:MouseEvent):void
{
if(ctrlPressed)
{
// removeMultiSelector();
if(ctrlArray.length>0)
{
var ind:int = this.getChildIndex(event.currentTarget as DisplayObject);
var chBool:Boolean=false;
for (var i:int=0; i<ctrlArray.length; i++)
{
if (ctrlArray[i].index==ind)
{
ind = i;
chBool=true;
}
}
if(chBool==true)
{
ctrlArray.splice(ind,1);
(event.currentTarget as UIComponent).filters=[];
/* (event.currentTarget as UIComponent).setStyle("borderStyle",'solid');
(event.currentTarget as UIComponent).setStyle("borderThickness",0);
(event.currentTarget as UIComponent).setStyle("borderColor",0x000000); */
}
else
{
(event.currentTarget as UIComponent).filters=[new GlowFilter(0x8fcef6,0.7,2,2,2,1)];
/* (event.currentTarget as UIComponent).setStyle("borderStyle",'solid');
(event.currentTarget as UIComponent).setStyle("borderThickness",2);
(event.currentTarget as UIComponent).setStyle("borderColor",0x000000); */
var coordinates:Object=new Object();
coordinates.x=(event.currentTarget as DisplayObject).x;
coordinates.y=(event.currentTarget as DisplayObject).y;
coordinates.index=this.getChildIndex(event.currentTarget as DisplayObject);
ctrlArray.push(coordinates);
}
}
else
{
(event.currentTarget as UIComponent).filters=[new GlowFilter(0x8fcef6,0.7,2,2,2,1)];
/* (event.currentTarget as UIComponent).setStyle("borderStyle",'solid');
(event.currentTarget as UIComponent).setStyle("borderThickness",2);
(event.currentTarget as UIComponent).setStyle("borderColor",0x000000); */
var coordinates:Object=new Object();
coordinates.x=(event.currentTarget as DisplayObject).x;
coordinates.y=(event.currentTarget as DisplayObject).y;
coordinates.index=this.getChildIndex(event.currentTarget as DisplayObject);
ctrlArray.push(coordinates);
}
}
else
{
for(var c:int=0;c<ctrlArray.length;c++)
{
this.getChildAt(ctrlArray[c].index).filters=[];
/* (bgCan.getChildAt(ctrlArray[c].index) as UIComponent).setStyle("borderStyle",'solid');
(bgCan.getChildAt(ctrlArray[c].index) as UIComponent).setStyle("borderThickness",0);
(bgCan.getChildAt(ctrlArray[c].index) as UIComponent).setStyle("borderColor",0x000000); */
}
ctrlArray=new Array();
}
}
public var shape:String;
public function addGroupSelection(event:MouseEvent):void
{
//removeSelection();
shape=new String();
cursorManager.removeAllCursors();
//mainCan.clear();
//removeConnector(event);
//clearControl();
if(selectMode==false&&selection==false)
{
if(this.hasEventListener(MouseEvent.MOUSE_DOWN))
{
this.removeEventListener(MouseEvent.MOUSE_DOWN, startSelectionDrawing_handler);
}
if(this.hasEventListener(MouseEvent.DOUBLE_CLICK))
{
this.removeEventListener(MouseEvent.DOUBLE_CLICK,clearSelection);
}
this.addEventListener(MouseEvent.MOUSE_DOWN, startSelectionDrawing_handler);
this.addEventListener(MouseEvent.DOUBLE_CLICK,clearSelection);
for(var c:int=0;c<ctrlArray.length;c++)
{
this.getChildAt(ctrlArray[c].index).filters=[];
}
ctrlArray=new Array();
}
}
override public function addChild(child:DisplayObject):DisplayObject
{
super.addChild(child);
child.addEventListener(MouseEvent.CLICK,multiselectionevent);
updateSelection();
return child;
}
override public function addChildAt(child:DisplayObject, index:int):DisplayObject
{
super.addChildAt(child,index);
child.addEventListener(MouseEvent.CLICK,multiselectionevent);
updateSelection();
return child;
}
private function updateSelection():void
{
for(var i:int=0;i<this.numChildren;i++)
{
if(this.getChildAt(i).name=="MAnt")
{
this.setChildIndex((this.getChildAt(i) as DisplayObject),this.numChildren-1);
return;
}
}
}
public var but:Button;
public var subObj:ObjectHandles;
public var ObjMain:Object;
public function add():void
{
but=new Button();
but.label='Object';
but.name='test1'
but.percentHeight=100;
but.percentWidth=100;
subObj=new ObjectHandles();
subObj.name='test1';
subObj.x=40;
subObj.y=40;
subObj.addChild(but);
this.addChild(subObj);
ObjMain=subObj;
ObjMain.name='test1';
trace(ObjMain.name);
}
public function remove():void
{
if(selectedItemsArr.length>0)
{
clear();
}
else if(subObj.name=='test1')
{
this.removeChild((subObj as Button).parent as ObjectHandles);
}
}
]]>
</mx:Script>
<mx:Button click="add()" x="6" y="4" label="Add Button"/>
<mx:Button click="creationComplete_handler()" x="105" y="4" label="Multi Selection"/>
<!--<mx:CheckBox id="chek" name="test1" x="120" y="121" label="Checkbox"/>
<mx:ColorPicker id="colr" name="test2" x="120" y="151"/>
<mx:ComboBox id="comb" name="test3" x="120" y="181"></mx:ComboBox>
<mx:Label id="lab" name="test4" x="120" y="211" text="Label"/>
<mx:NumericStepper id="numb" name="test5" x="120" y="237"/>
<mx:TextInput id="textin" name="test6" x="120" y="267"/>-->
<view:MarchingAntsSelectionRectangle name="MAnt" lineThickness="1" x="0" y="0" id="marchingAntsSelectionRect"/>
<mx:Button click="remove()" x="226" y="4" label="Delete"/>
</mx:Canvas>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" borderColor="#818282">
<mx:Script><![CDATA[
import mx.controls.Label;
import mx.charts.series.items.LineSeriesItem;
import mx.collections.ArrayCollection;
import mx.charts.series.items.ColumnSeriesItem;
import mx.charts.ChartItem;
[Bindable]
public var profits:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:1300},
{Month:"Feb", Profit:750},
{Month:"Mar", Profit:1100},
{Month:"Apr", Profit:1000},
{Month:"May", Profit:980},
{Month:"Jun", Profit:1500},
{Month:"Jul", Profit:2060},
{Month:"Aug", Profit:1700},
{Month:"Sep", Profit:1690},
{Month:"Oct", Profit:2200},
{Month:"Nov", Profit:2550},
{Month:"Dec", Profit:3000}
]);
private function connectTwoPoints(month1:String,
value1:Number,
month2:String,
value2:Number
):void {
canvas.clear();
canvas.lineStyle(4,
0xff0000,
.75,
true,
LineScaleMode.NORMAL,
CapsStyle.ROUND,
JointStyle.MITER,
2
);
canvas.moveTo(month1, value1);
canvas.lineTo(month2, value2);
l1.text = "Month: " + month1;
l2.text = "Profit: " + value1;
l3.text = "Month: " + month2;
l4.text = "Profit: " + value2;
chartHasLine = true;
}
private var s1:String = new String();
private var s2:String = new String();
private var v1:Number = new Number();
private var v2:Number = new Number();
// Set this to true initially so that the chart doesn't
// draw a line when the first item is clicked.
private var chartHasLine:Boolean = true;
private function handleChange(event:Event):void {
var sci:LineSeriesItem =
LineSeriesItem(myChart.selectedChartItem);
if (chartHasLine)
{
canvas.clear();
s1 = sci.item.Month;
v1 = sci.item.Profit;
addLabelsToColumn(s1,v1);
chartHasLine = false;
} else
{
s2 = sci.item.Month;
v2 = sci.item.Profit;
addLabelsToColumn(s2,v2);
connectTwoPoints(s1, v1, s2, v2);
}
}
[Bindable]
public var columnLabel:Label;
private function addLabelsToColumn(s:String, n:Number):void {
columnLabel = new Label();
columnLabel.setStyle("fontWeight", "bold");
columnLabel.setStyle("color", "0x660000");
columnLabel.text = s + ": " + "$" + n;
// This adds any DisplayObject as child to current canvas.
canvas.addDataChild(columnLabel, s, n);
}
]]></mx:Script>
<mx:Panel title="Vertical Line For Column Chart" x="364" y="30" width="479" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="#FFFFFF" height="563" borderColor="#A4A09C" color="#000000" headerColors="red">
<mx:LineChart id="myChart"
dataProvider="{profits}"
selectionMode="single"
change="handleChange(event)"
width="458">
<mx:annotationElements>
<mx:CartesianDataCanvas id="canvas" includeInRanges="true"/>
</mx:annotationElements>
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{profits}"
categoryField="Month"
/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries
id="series1"
xField="Month"
yField="Profit"
displayName="Profit"
selectable="true"
/>
</mx:series>
</mx:LineChart>
<mx:RadioButton id="b1"
label="Connect One Points"
click="connectTwoPoints('Jan', 1300, 'Jan', 0);"/>
<mx:RadioButton id="b0"
label="Connect Two Points"
click="connectTwoPoints('Jul', 2060, 'Jul', 0);"/>
<mx:RadioButton id="b2"
label="Connect Three Points"
click="connectTwoPoints('Sep', 1690, 'Sep', 0);"/>
<mx:HBox visible="false">
<mx:VBox>
<mx:Label text="First Item"/>
<mx:Label id="l1"/>
<mx:Label id="l2"/>
</mx:VBox>
<mx:VBox >
<mx:Label text="Second Item"/>
<mx:Label id="l3"/>
<mx:Label id="l4"/>
</mx:VBox>
</mx:HBox>
</mx:Panel>
</mx:Application>
DEMO
<?xml version="1.0" encoding="utf-8"?>
<mx:Application creationComplete="bar.visible=false;" xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#ffffff" layout="absolute" width="1345" xmlns:ns1="com.flexer.*">
<mx:Script>
<![CDATA[
import mx.utils.ObjectUtil;
import mx.controls.Label;
import mx.managers.PopUpManager;
import mx.controls.Alert;
[Bindable]
public var dataxml:XML;
[Bindable]
public var datalist:XML=new XML(<data/>);
[Bindable]
public var xxx:XMLList;
private var data2xml:XML;
private var data2list:XML=new XML(<data/>);
private var xxx2:XMLList;
[Bindable]
public var labstring:String;
public function add():void
{
dataxml=new XML(<employee/>);
dataxml.@id=tex1.text;
dataxml.@age=tex2.text;
dataxml.@add=tex3.text;
dataxml.@city=tex4.text;
dataxml.@state=tex5.text;
trace(dataxml);
datalist.appendChild(dataxml);
xxx=new XMLList(datalist.children());
data.dataProvider=xxx;
Alert.show("DATAS SEND SUCCESSFULLY");
}
public function clr():void
{
tex1.text=''
tex2.text=''
tex3.text=''
tex4.text=''
tex5.text=''
}
var re1:Report1;
public var nameStr:String;
public function search(event:MouseEvent):void
{
vb.removeAllChildren();
if(datalist.employee.length()<1)
{
Alert.show("List Empty");
}
for(var j:int=0;j<datalist.employee.length();j++)
{
if(searchT.text==datalist.employee[j].@id)
{
/* tex1.text=datalist.employee[j].@id;
tex2.text=datalist.employee[j].@age;
tex3.text=datalist.employee[j].@add;
tex4.text=datalist.employee[j].@city;
tex5.text=datalist.employee[j].@state; */
re1=new Report1();
re1.str1=datalist.employee[j].@id;
re1.str2=datalist.employee[j].@age;
re1.str3=datalist.employee[j].@add;
re1.str4=datalist.employee[j].@city;
re1.str5=datalist.employee[j].@state;
vb.addChild(re1);
}
else
{
//Alert.show("Nothing Found");
}
}
}
public function add2():void
{
data2xml=new XML(<employee/>);
data2xml.@ip=tex11.text;
data2xml.@sys=tex12.text;
data2xml.@pass=tex13.text;
data2xml.@repas=tex14.text;
data2list.appendChild(data2xml);
xxx2=new XMLList(data2list.children());
data1.dataProvider=xxx2;
Alert.show("DATAS SEND SUCCESSFULLY");
}
public function clr2():void
{
tex11.text=''
tex12.text=''
tex13.text=''
tex14.text=''
}
var re2:Report2;
public function search2():void
{
vb.removeAllChildren();
if(data2list.employee.length()<1)
{
Alert.show("List Empty");
}
for(var j:int=0;j<data2list.employee.length();j++)
{
if(searchTT.text==data2list.employee[j].@ip)
{
/* tex11.text=data2list.employee[j].@ip;
tex12.text=data2list.employee[j].@sys;
tex13.text=data2list.employee[j].@pass;
tex14.text=data2list.employee[j].@repas; */
re2=new Report2();
re2.str11=data2list.employee[j].@ip;
re2.str12=data2list.employee[j].@sys;
re2.str13=data2list.employee[j].@pass;
re2.str14=data2list.employee[j].@repas;
vb.addChild(re2);
}
else
{
//Alert.show("Nothing Found");
}
}
}
public function show():void
{
can1.visible=false;
can2.visible=true;
}
public function show2():void
{
can1.visible=true;
can2.visible=false;
}
public function login():void
{
if(usern.text=='demo'&&passw.text=='demo')
{
can1.visible=true;
pan.removeChild(log);
bar.visible=true;
}
}
public function remo():void
{
vb.removeAllChildren();
}
public function allr():void
{
vb2.removeAllChildren();
//Alert.show('test');
for(var k:int=0;k<datalist.children().length();k++)
{
var re1:Report1=new Report1();
re1.str1=datalist.children()[k].@id;
re1.str2=datalist.children()[k].@age;
re1.str3=datalist.children()[k].@add;
re1.str4=datalist.children()[k].@city;
re1.str5=datalist.children()[k].@state;
vb2.addChild(re1);
}
}
var k:int=0;
var m:int=0;
var Count:int=0;
var chkStr:String;
public var info:information;
public function slidNext():void
{
if(k==datalist.children().length()-0)
{
k=0;
trace('This is for Next');
info=new information();
HB.addChild(info);
}
else
{
re1=new Report1();
re1.str1=datalist.children()[k].@id;
re1.str2=datalist.children()[k].@age;
re1.str3=datalist.children()[k].@add;
re1.str4=datalist.children()[k].@city;
re1.str5=datalist.children()[k].@state;
HB.addChild(re1);
k=k+1;
}
}
var all:Allrepo;
public function AdmNext():void
{
if(m==data2list.children().length()-0)
{
m=0;
all=new Allrepo();
HB.addChild(all);
trace('test');
}
else
{
re2=new Report2();
re2.str11=data2list.children()[m].@ip;
re2.str12=data2list.children()[m].@sys;
re2.str13=data2list.children()[m].@pass;
re2.str14=data2list.children()[m].@repas;
HB.addChild(re2);
m=m+1;
}
}
public function AdmPrve():void
{
m=m-1;
if(m==data2list.children().length()-0)
{
trace('test');
}
else
{
re2=new Report2();
re2.str11=data2list.children()[m].@ip;
re2.str12=data2list.children()[m].@sys;
re2.str13=data2list.children()[m].@pass;
re2.str14=data2list.children()[m].@repas;
HB.addChild(re2);
}
}
public function slidPrev():void
{
k=k-1;
if(k==datalist.children().length()-0)
{
trace('This is for Prev');
}
else
{
re1=new Report1();
re1.str1=datalist.children()[k].@id;
re1.str2=datalist.children()[k].@age;
re1.str3=datalist.children()[k].@add;
re1.str4=datalist.children()[k].@city;
re1.str5=datalist.children()[k].@state;
HB.addChild(re1);
}
}
public function delt():void
{
for(var j:int=0;j<datalist.employee.length();j++)
{
if(searchT.text==datalist.employee[j].@id)
{
delete datalist.children()[j];
xxx=new XMLList(datalist.children());
data.dataProvider=xxx;
vb.removeAllChildren();
}
}
}
public function delt2():void
{
for(var j:int=0;j<data2list.employee.length();j++)
{
if(searchTT.text==data2list.employee[j].@ip)
{
delete data2list.children()[j];
xxx2=new XMLList(data2list.children());
data.dataProvider=xxx;
vb.removeAllChildren();
}
}
}
public function tes():void
{
Alert.show(xxx);
}
public var cha:PopupChart=new PopupChart();
public function tes1():void
{
PopUpManager.addPopUp(cha,this,true);
PopUpManager.centerPopUp(cha);
/* cha.pie.dataProvider=xxx;
cha.PS.xField=xxx.@age;
cha.PS.yField=xxx.@id;
cha.PS.labelField=xxx.@city;
trace(cha.pie.dataProvider); */
}
]]>
</mx:Script>
<mx:Iris id="irisOut" duration="1000" showTarget="true"/>
<mx:Iris id="irisIn" duration="1000" showTarget="false"/>
<mx:Panel id="pan" x="406" y="207" width="579" height="446" layout="absolute" horizontalScrollPolicy="auto" includeInLayout="true" paddingBottom="30" borderThickness="5" cornerRadius="15" >
<mx:Canvas id="can1" visible="false" backgroundColor="#ffffff" height="100%" width="100%">
<mx:Label text="User Account" textDecoration="underline" fontSize="14" fontWeight="bold" x="195" y="30"/>
<mx:Form visible="true" x="95" y="84" height="184" width="410.5" fontWeight="bold">
<mx:FormItem label="ID" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex1"/>
</mx:FormItem>
<mx:FormItem label="Age" fontWeight="bold" width="290" fontSize="12">
<mx:TextInput id="tex2" width="163"/>
</mx:FormItem>
<mx:FormItem label="Address" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex3"/>
</mx:FormItem>
<mx:FormItem label="City" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex4"/>
</mx:FormItem>
<mx:FormItem label="State" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex5"/>
</mx:FormItem>
</mx:Form>
<mx:HBox x="60" y="368" width="480" height="28">
<mx:Button id="but1" click="add()" label="Save"/>
<mx:Button label="Delete" click="delt()"/>
<mx:Button id="but2" click="clr()" label="Clear"/>
<mx:TextInput id="searchT" width="137"/>
<mx:Button click="search(event)" label="Search"/>
<mx:Label text="*ID only."/>
</mx:HBox>
<mx:DataGrid id="data" width="559" height="396" visible="{cb1.selected}"
showEffect="{irisIn}" hideEffect="{irisOut}" borderStyle="outset" alpha="1.0" dropShadowColor="black" dropShadowEnabled="true" shadowDirection="right" shadowDistance="5" editable="true" fontWeight="bold" x="0" y="10">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="@id"/>
<mx:DataGridColumn headerText="Age" dataField="@age"/>
<mx:DataGridColumn headerText="Address" dataField="@add"/>
<mx:DataGridColumn headerText="City" dataField="@city"/>
<mx:DataGridColumn headerText="State" dataField="@state"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
<mx:Canvas id="can2" visible="false" backgroundColor="#ffffff" height="100%" width="100%">
<mx:Label text="Admin Account" textDecoration="underline" fontSize="14" fontWeight="bold" x="195" y="30"/>
<mx:Form visible="true" x="69" y="84" height="184" width="410.5" fontWeight="bold">
<mx:FormItem label="IP" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex11"/>
</mx:FormItem>
<mx:FormItem label="Sys no" fontWeight="bold" width="290" fontSize="12">
<mx:TextInput id="tex12" width="163"/>
</mx:FormItem>
<mx:FormItem label="Password" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex13"/>
</mx:FormItem>
<mx:FormItem label="Repassword" fontWeight="bold" fontSize="12">
<mx:TextInput id="tex14"/>
</mx:FormItem>
</mx:Form>
<mx:HBox x="60" y="368" width="480" height="28">
<mx:Button id="but11" click="add2()" label="Save"/>
<mx:Button label="Delete" click="delt2()"/>
<mx:Button id="but12" click="clr2()" label="Clear"/>
<mx:TextInput id="searchTT" width="137"/>
<mx:Button click="search2()" label="Search"/>
<mx:Label text="*IP only."/>
</mx:HBox>
<mx:DataGrid id="data1" width="559" height="396" visible="{cb1.selected}"
showEffect="{irisIn}" hideEffect="{irisOut}" borderStyle="outset" alpha="1.0" dropShadowColor="black" dropShadowEnabled="true" shadowDirection="right" shadowDistance="5" editable="true" fontWeight="bold" x="0" y="10">
<mx:columns>
<mx:DataGridColumn headerText="IP" dataField="@ip"/>
<mx:DataGridColumn headerText="Sys no" dataField="@sys"/>
<mx:DataGridColumn headerText="Password" dataField="@pass"/>
<mx:DataGridColumn headerText="Repassword" dataField="@repas"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
<mx:Canvas id="log" x="0" y="1" width="100%" height="100%" borderStyle="solid" backgroundColor="#FFFFFF">
<mx:Form x="159" y="113" width="333" height="100">
<mx:FormItem label="User name" fontWeight="bold" fontSize="13">
<mx:TextInput id="usern"/>
</mx:FormItem>
<mx:FormItem label="Password" fontWeight="bold" fontSize="13">
<mx:TextInput id="passw"/>
</mx:FormItem>
</mx:Form>
<mx:Button click="login()" x="275" y="221" label="Submit"/>
</mx:Canvas>
</mx:Panel>
<mx:ApplicationControlBar id="bar" width="579" height="31" cornerRadius="15" fillColors="black" barColor="black" fillAlphas="[0.55, 0.54]" alpha="1.0" color="black" x="406" y="207">
<mx:Button click="show2()" label="User"/>
<mx:Button click="show()" label="Admin"/>
<mx:HRule shadowColor="gray" strokeColor="gray" alpha="0.0" width="43" height="2"/>
<mx:CheckBox id="cb1" label="View Full Details" selected="false" color="#080808" fontWeight="bold"/>
</mx:ApplicationControlBar>
<mx:VBox horizontalScrollPolicy="off" id="vb" x="134" y="221" height="142" width="260" backgroundColor="#E0DCDC">
</mx:VBox>
<mx:Button click="remo()" x="134" y="191" label="Remove All"/>
<mx:Button click="allr()" x="134" y="371" label="View All"/>
<mx:VBox horizontalScrollPolicy="off" id="vb2" height="432" width="260" backgroundColor="#E0DCDC" x="134" y="397">
</mx:VBox>
<mx:Canvas id="main" x="993" y="221" width="288" height="200">
<mx:Canvas id="HB" verticalScrollPolicy="off" horizontalScrollPolicy="off" x="10" y="45" width="260" height="145" backgroundColor="#D6D3D3" borderStyle="solid">
<mx:Label x="37.5" y="91" text="Click the Button for User Details" height="18"/>
<!--<mx:Button click="slidPrev()" x="103" y="61" label="Click"/>-->
</mx:Canvas>
<mx:HBox id="H1" x="10" y="14" width="94" height="23">
<mx:Button id="prev" click="slidPrev()" label="<"/>
<mx:Button id="next" click="slidNext()" label=">"/>
</mx:HBox>
<mx:HBox id="H2" visible="false" x="10" y="14" width="94" height="23">
<mx:Button id="Aprev" click="AdmPrve()" label="<"/>
<mx:Button id="Anext" click="AdmNext()" label=">"/>
</mx:HBox>
</mx:Canvas>
<mx:Button click="tes()" x="640" y="93" label="Button"/>
<mx:Button click="tes1()" x="736" y="93" label="Chart"/>
</mx:Application>
DEMO HERE :(user Name:demo,Password:demo)