4,328
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
protected function button1_clickHandler(event:MouseEvent):void
{
var can:TCanvas=new TCanvas();
can.imageSrc = image.source;
PopUpManager.addPopUp(can, this, true);
}
]]>
</mx:Script>
<mx:VBox>
<mx:Canvas id="canvas" >
<mx:Image id="image"
source="img\bg.jpg"
width="300"
height="300">
</mx:Image>
</mx:Canvas>
<mx:Canvas id="temp">
</mx:Canvas>
<mx:Button label="reset"
click="button1_clickHandler(event)"/>
</mx:VBox>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="1000" showCloseButton="true"
close="PopUpManager.removePopUp(this)"
height="500">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import flash.display.Bitmap;
import flash.events.MouseEvent;
[Bindable]
private var _bit:Bitmap=new Bitmap();
[Bindable]
private var oldX:Number, oldY:Number;
[Bindable]
public var imageSrc:Object = null;
public function get bit():Bitmap
{
return _bit;
}
public function set bit(value:Bitmap):void
{
_bit=value;
}
protected function image_2_mouseDownHandler(event:MouseEvent):void
{
var b:Bitmap=new Bitmap();
oldX=event.stageX;
oldY=event.stageY;
}
protected function image_2_mouseMoveHandler(event:MouseEvent):void
{
if (event.buttonDown)
{
var x:Number=event.stageX - oldX;
var y:Number=event.stageY - oldY;
oldX=event.stageX;
oldY=event.stageY;
image_2.move(image_2.x + x, image_2.y + y);
}
}
]]>
</mx:Script>
<mx:Canvas id="canvas_2" width="100%" height="100%">
<mx:Image id="image_2"
source="{imageSrc}"
width="100%" height="100%"
mouseDown="image_2_mouseDownHandler(event)"
mouseMove="image_2_mouseMoveHandler(event)">
</mx:Image>
</mx:Canvas>
</mx:TitleWindow>