<mx:Application creationComplete="init()" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import com.roguedevelopment.objecthandles.ObjectHandles;
import mx.controls.TextArea;
import mx.managers.PopUpManager;
import mx.managers.DragManager;
import mx.events.DragEvent;
import flash.events.MouseEvent;
import mx.core.DragSource;
private var cm:ContextMenu;
private var originalMenu : ContextMenu;
private var fileadd:FileReferenceList=new FileReferenceList();
<-------- Rectangle Components-------->
public function recta():void
{
var rct:comRectangle=new comRectangle();
var obh:ObjectHandles=new ObjectHandles();
obh.allowVResize=true;
obh.allowHResize=true;
rct.percentHeight=100;
rct.percentWidth=100;
obh.width=100;
obh.height=100;
obh.addChild(rct);
can.addChild(obh);
}
<-------- Circle Components-------->
public function circle():void
{
var crl:comCircle=new comCircle();
var obh:ObjectHandles=new ObjectHandles();
obh.allowHResize=true;
obh.allowVResize=true;
//obh.setStyle('backgroundColor','cp.selectedColor');
crl.percentHeight=100;
crl.percentWidth=100;
obh.height=100;
obh.width=100;
obh.x=150;
obh.y=100;
obh.addChild(crl);
can.addChild(obh);
}
<-------- Line Components-------->
public function line():void
{
var lne:comLine=new comLine();
var obh:ObjectHandles=new ObjectHandles();
obh.allowVResize=true;
obh.allowHResize=true;
obh.allowRotate=true;
lne.percentHeight=100;
lne.percentWidth=100;
obh.width=100;
obh.height=10;
obh.addChild(lne);
can.addChild(obh);
}
<-------- Text Components-------->
public function textA():void
{
var ta:T1=new T1();
var obh:ObjectHandles=new ObjectHandles();
obh.allowHResize=true;
obh.allowVResize=true;
obh.addChild(ta);
can.addChild(ta);
}
public function Clear():void
{
can.removeAllChildren();
}
public function canvas():void
{
can.visible=true;
}
<-------- Image Components-------->
public function load():void
{
var imgrot:comImageRotation=new comImageRotation();
var obh:ObjectHandles=new ObjectHandles();
obh.allowRotate=true;
obh.x=150;
obh.y=100;
obh.addChild(imgrot);
can.addChild(obh);
}
private function init():void{
Application.application.contextMenu.hideBuiltInItems();
var defaultItems:ContextMenuBuiltInItems = Application.application.contextMenu.builtInItems;
defaultItems.print = true;
var custLinkItem : ContextMenuItem = new
ContextMenuItem('Remove');
//removeChild(can);
Application.application.contextMenu.customItems.push(custLinkItem);
custLinkItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, goCustBtn);
originalMenu = Application.application.contextMenu;
}
private function goCustBtn(event:ContextMenuEvent):void{
//event for the custom button
}
public function Img():void
{
var pop:comp=new comp();
PopUpManager.addPopUp(pop,this,true);
PopUpManager.centerPopUp(pop);
}
public function file():void
{
fileadd.browse();
}
private function mouseMoveHandler(event:MouseEvent):void
{
var dragInitiator:TextArea=TextArea(event.currentTarget);
var ds:DragSource = new DragSource();
ds.addData(dragInitiator, "Tex");
DragManager.doDrag(dragInitiator, ds, event);
}
private function dragEnterHandler(event:DragEvent):void
{
if (event.dragSource.hasFormat("Tex"))
{
DragManager.acceptDragDrop(Canvas(event.currentTarget));
}
}
private function dragDropHandler(event:DragEvent):void
{
TextArea(event.dragInitiator).x =
(event.currentTarget).mouseX;
TextArea(event.dragInitiator).y =
(event.currentTarget).mouseY;
}
public function doZoom(event:MouseEvent):void
{
if (zoomAll.isPlaying) {
zoomAll.reverse();
}
else {
// If this is a ROLL_OUT event, play the effect backwards.
// If this is a ROLL_OVER event, play the effect forwards.
zoomAll.play([event.target], event.type == MouseEvent.ROLL_OUT ? true : false);
}
}
]]>
</mx:Script>
<mx:Zoom id="zoomAll" zoomWidthTo="1" zoomHeightTo="1" zoomWidthFrom=".5" zoomHeightFrom=".5" />
<mx:Canvas x="419" y="249" width="593" height="486" borderColor="#000000" backgroundColor="#95918C" borderStyle="solid" borderThickness="8">
<mx:Canvas backgroundColor="#FFFFFF" x="484" y="30" width="64" height="390" borderStyle="solid" borderColor="black" borderThickness="2">
<mx:Button x="11" y="28" width="34" height="35" icon="@Embed(source='img/14_select.png')" fillColors="[#FFFFFF, #726F6F]" color="white" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Cursor" alpha="1.0" borderColor="green"/>
<mx:Button click="textA()" x="11" y="65" width="34" height="34" icon="@Embed(source='img/format-text-italic.png')" fillColors="[#FFFFFF, #726F6F]" color="white" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Text" alpha="1.0" borderColor="green"/>
<mx:Button click="line()" x="11" y="102" width="34" height="28" icon="@Embed(source='img/Line.png')" fillColors="[#FFFFFF, #848181]" color="white" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Line" alpha="1.0" borderColor="green" fontWeight="bold"/>
<mx:Button click="recta()" x="11" y="133" width="34" height="28" icon="@Embed(source='img/rectangle.png')" fillColors="[#FFFFFF, #848181]" color="white" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Rectangle" alpha="1.0" borderColor="green" fontWeight="bold"/>
<mx:ColorPicker id="cp" x="14" y="286" width="27" height="25" toolTip="ColorPicker" selectedColor="#FFFFFF"/>
<mx:Button click="circle()" x="12" y="167" width="32" height="28" icon="@Embed(source='img/Circle.png')" fillColors="[#FFFFFF, #848181]" color="white" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Circle" alpha="1.0" borderColor="green" fontWeight="bold"/>
<mx:Button click="Img()" x="12" y="242" toggle="true" width="31" height="28" fillColors="[#FFFFFF, #848181]" color="#080808" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Ellipse" label="#" fontWeight="bold" fontSize="20" alpha="1.0" borderColor="green" icon="@Embed(source='img/3x3_grid (1).png')"/>
<mx:Button click="file()" x="12" y="204" width="32" height="28" icon="@Embed(source='img/image-x-generic.png')" fillColors="[#FFFFFF, #848181]" color="white" fillAlphas="[0.5, 0.5, 0.5, 0.5]" toolTip="Circle" alpha="1.0" borderColor="green" fontWeight="bold"/>
<mx:Canvas x="0" y="0" width="100%" height="22" backgroundColor="#B3D9F7">
<mx:Label text="Tools" fontWeight="bold" x="10.5" y="0"/>
</mx:Canvas>
</mx:Canvas>
<mx:ApplicationControlBar x="0" y="420" width="577" height="46" fillAlphas="[1.0, 1.0]" fillColors="[#95918C, #95918C]">
<mx:Button click="Clear()" label="Clear"/>
</mx:ApplicationControlBar>
<mx:Label x="29" y="-2" text="MY EDITOR" fontWeight="bold" fontSize="18" color="#A0D9F4"/>
<mx:Button click="load()" label="Image" x="188" y="70"/>
<mx:Canvas id="can" click="canvas()" dragEnter="dragEnterHandler(event)" dragDrop="dragDropHandler(event)" rollOver="doZoom(event)"
rollOut="doZoom(event)" x="32" y="30" width="450" height="390" backgroundColor="{cp.selectedColor}" borderColor="black" borderThickness="2" borderStyle="solid">
</mx:Canvas>
</mx:Canvas>
</mx:Application>
SCREEN SHOT & DEMO HERE