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

flex图片拖动效果

发布时间:2020-12-15 03:38:54 所属栏目:百科 来源:网络整理
导读:[flex]图片拖动效果 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 ?xml version= "1.0" ? encoding= "utf-8" ? mx:Application xmlns:mx= "ht

[flex]图片拖动效果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version= "1.0"? encoding= "utf-8" ?>
<mx:Application xmlns:mx= "http://www.adobe.com/2006/mxml"? layout= "horizontal"? horizontalScrollPolicy= "off"? verticalScrollPolicy= backgroundGradientAlphas= "0.5"? backgroundGradientColors= "black"? color= "#FFFFFF"? backgroundColor= "#FFFFFF" >
???? <mx:Script>
? <![CDATA[
???? import? mx.events.ListEvent;
?? // horizontalScrollPolicy="off" verticalScrollPolicy="off" 这二个属性为off 时,是超过容器的边框时,不会有下拉框
?? var? oldx,oldy: Number ;
?? function? mouseMove(event:MouseEvent): void {
??? if (event.buttonDown){
??? x: =event.stageX-oldx; //移动的x坐标
y: =event.stageY-oldy; //移动的y坐标
??? oldx=event.stageX;? //把当时的坐标 给oldx oldy
oldy=event.stageY;
p.move(p.x+x,p.y+y); //move 是移动函数
}
?? }
???
?? private? mouseDown(event:MouseEvent): {
CursorManager.removeAllCursors();
cursorID = CursorManager.setCursor(BugDeleteIcon);
oldx=event.stageX; // 当鼠标按下时,就把当时的坐标 给oldx oldy
oldy=event.stageY;
?
}
???
mouseUp(event:MouseEvent): {
CursorManager.removeAllCursors();
cursorID = CursorManager.setCursor(BugIcon);
}
]]>
</mx:Script>
<mx:Script >
???????? <![CDATA[
???????????? mx.managers.CursorManager;
??
???????????? [Bindable]
[Embed(source= "img/zhang.png" )]
private? BugIcon:Class;
??
[Bindable]
"img/quan.png" )]
BugDeleteIcon:Class;
??
cursorID: int ;
]]>
</mx:Script >
?
?
<mx:Panel id= "p"? x= "180"? y= "128"? width= "1589"? height= "1640"? "absolute"? title= "上海地铁总平面图"? mouseMove= "mouseMove(event)"
mouseDown= "mouseDown(event)"?? mouseUp= "mouseUp(event)"?? backgroundImage= "@Embed(source='img/mapnew.gif')"? borderThicknessLeft= "0"? borderThicknessRight= "0"
borderThicknessTop= rollOver= "cursorID = CursorManager.setCursor(BugIcon);"? rollOut= "CursorManager.removeCursor(cursorID);"? fontSize= "12"? "#1F5DB2"? backgroundSize= "100%" >
</mx:Panel>
</mx:Application>

(编辑:李大同)

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

    推荐文章
      热点阅读