flash内图片放大缩小和移动
flash文件中有1个图片,双击图片放大,再次双击图片缩小,而且放大缩小后的图片可以移动。在网上找了几段代码,都不能完全实现。比较相近的只有这段,点击图片放大,松开图片缩...
flash文件中有1个图片,双击图片放大,再次双击图片缩小,而且放大缩小后的图片可以移动。在网上找了几段代码,都不能完全实现。比较相近的只有这段,点击图片放大,松开图片缩小。请高手指点,不胜感谢!
参考代码:
for (var d:Number = 0; d<=1; d++) {
this["pic"+d+"_mc"].onPress = function() {
mx.behaviors.DepthControl.bringToFront(this);
startDrag(this);
this.onEnterFrame = function() {
this._xscale += (200-this._xscale)/4;
this._yscale += (200-this._yscale)/4;
if (this._xscale>=200) {
delete this.onEnterFrame;
}
};
};
this["pic"+d+"_mc"].onRelease = function() {
stopDrag();
this.onEnterFrame = function() {
this._xscale -= (this._xscale-100)/4;
this._yscale -= (this._yscale-100)/4;
if (this._xscale<=100) {
delete this.onEnterFrame;
}
};
};
} 展开
参考代码:
for (var d:Number = 0; d<=1; d++) {
this["pic"+d+"_mc"].onPress = function() {
mx.behaviors.DepthControl.bringToFront(this);
startDrag(this);
this.onEnterFrame = function() {
this._xscale += (200-this._xscale)/4;
this._yscale += (200-this._yscale)/4;
if (this._xscale>=200) {
delete this.onEnterFrame;
}
};
};
this["pic"+d+"_mc"].onRelease = function() {
stopDrag();
this.onEnterFrame = function() {
this._xscale -= (this._xscale-100)/4;
this._yscale -= (this._yscale-100)/4;
if (this._xscale<=100) {
delete this.onEnterFrame;
}
};
};
} 展开
4个回答
展开全部
flash 8
on (press) {
//Start Dragging Movieclip Behavior
startDrag(this);
//End Behavior
}
on (release) {
//Movieclip GotoAndStop Behavior
this.gotoAndStop("5");
//End Behavior
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior
}
on (release) {
gotoAndPlay(1);
//Movieclip GotoAndStop Behavior
this.gotoAndStop("1");
//End Behavior
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior
}
on (press) {
//Start Dragging Movieclip Behavior
startDrag(this);
//End Behavior
}
有必要把flash文件给你
on (press) {
//Start Dragging Movieclip Behavior
startDrag(this);
//End Behavior
}
on (release) {
//Movieclip GotoAndStop Behavior
this.gotoAndStop("5");
//End Behavior
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior
}
on (release) {
gotoAndPlay(1);
//Movieclip GotoAndStop Behavior
this.gotoAndStop("1");
//End Behavior
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior
}
on (press) {
//Start Dragging Movieclip Behavior
startDrag(this);
//End Behavior
}
有必要把flash文件给你
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
flash AS3.0
/*************************************************/
var delay:uint=300;
var firstclick:uint;
var lastclick:uint;
var isbig:Boolean=false;
function ondoubleclick(e:MouseEvent):void{
if(firstclick==0){
firstclick=getTimer();
}else{
lastclick=getTimer();
if(lastclick-firstclick<delay){
if(isbig){
_mc.scaleX=0.5;
_mc.scaleY=0.5;
isbig=false;
}else{
_mc.scaleX=2;
_mc.scaleY=2;
isbig=true;
}
}
firstclick=getTimer();
}
}
function ondown(e:MouseEvent):void{
e.target.startDrag(false);
}
function onup(e:MouseEvent):void{
e.target.stopDrag();
}
_mc.addEventListener(MouseEvent.CLICK,ondoubleclick);
_mc.addEventListener(MouseEvent.MOUSE_DOWN,ondown);
_mc.addEventListener(MouseEvent.MOUSE_UP,onup);
其中_mc为影片剪辑 缩放大小有你自己控制,(_mc.scaleX=0.5;_mc.scaleY=0.5;缩小0.5倍)
(_mc.scaleX=2;_mc.scaleY=2;放大2倍)
/*************************************************/
var delay:uint=300;
var firstclick:uint;
var lastclick:uint;
var isbig:Boolean=false;
function ondoubleclick(e:MouseEvent):void{
if(firstclick==0){
firstclick=getTimer();
}else{
lastclick=getTimer();
if(lastclick-firstclick<delay){
if(isbig){
_mc.scaleX=0.5;
_mc.scaleY=0.5;
isbig=false;
}else{
_mc.scaleX=2;
_mc.scaleY=2;
isbig=true;
}
}
firstclick=getTimer();
}
}
function ondown(e:MouseEvent):void{
e.target.startDrag(false);
}
function onup(e:MouseEvent):void{
e.target.stopDrag();
}
_mc.addEventListener(MouseEvent.CLICK,ondoubleclick);
_mc.addEventListener(MouseEvent.MOUSE_DOWN,ondown);
_mc.addEventListener(MouseEvent.MOUSE_UP,onup);
其中_mc为影片剪辑 缩放大小有你自己控制,(_mc.scaleX=0.5;_mc.scaleY=0.5;缩小0.5倍)
(_mc.scaleX=2;_mc.scaleY=2;放大2倍)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你想实现 什么效果吗?说清楚点,帮帮你
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2009-04-28
展开全部
哎 as2的双击事件就是比较麻烦,用as3的话,就直接支持doubleClick事件了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询