ActionScript实现的画中画效果[代码]

      Flash学习 2005-8-5 22:20
今天参加了Flash8的一个AS练习主题[url=]画中画效果[/url]
我想了一下自己也做了一个,

=============源代码如下(Frame 1)===============================
var obj=mcbg.getBounds(_root);
var W=obj.xMax-obj.xMin;
var H=obj.yMax-obj.yMin;
var per0=W/Stage.width;
var per1=H/Stage.height;
_global.flag=true;
var big:MovieClip=this.attachMovie("y","1",10);
var lit:MovieClip=this.attachMovie("y","2",9);
lit._x=obj.xMin;
lit._y=obj.yMin;
lit._xscale=lit._yscale=per0*100;
function onR(){
    stopDrag();
    }
big.Btn.onPress=function(){
    flag=true;
    this._parent.startDrag();
    };
big.Btn.onRelease=onR;
lit.Btn.onPress=function(){
    flag=false;
    this._parent.startDrag();
    };
lit.Btn.onRelease=onR;
mcbg.onPress=function(){
    this.startDrag();
    }
mcbg.onRelease=onR;

this.onEnterFrame=function(){
    var obj=mcbg.getBounds(_root);
    var W=obj.xMax-obj.xMin;
    var H=obj.yMax-obj.yMin;
    if(flag){
    var per2=big._x/Stage.width;
    var per3=big._y/Stage.height;
    lit._x=obj.xMin+per2*W;
    lit._y=obj.yMin+per3*H;
    }else{
        //trace(lit._x);
        var per4=(lit._x-obj.xMin)/W;
        var per5=(lit._y-obj.yMin)/H;
        big._x=per4*Stage.width;
        big._y=per5*Stage.height;
        }
}
 源码下载
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}