Hi Folks,

Hier was zum ausprobieren - hiermit lassen sich Spielfelder einfach umsetzen.

PHP-Code:
MovieClip.prototype.panicMouse = function(distanztempobesch){
    var 
xdiff this._parent._xmouse this._x;
    var 
ydiff this._parent._ymouse this._y;
    var 
abstand Math.sqrt(xdiff*xdiff ydiff*ydiff);
    if (
abstand distanz){
        var 
winkel Math.atan2(ydiffxdiff);
        if (
beschtempo Math.min(tempobesch*distanz/abstand);
        
this._x -= Math.cos(winkel)*tempo;
        
this._y -= Math.sin(winkel)*tempo;
    }
}

MovieClip.prototype.constrainTo = function(cF){    
    var 
tb this.getBounds();
    if (
typeof cF == "movieclip"cF cF.getBounds(this._parent);
    if (
this._x tb.xmin cF.xminthis._x cF.xmin tb.xmax;
    if (
this._x tb.xmax cF.xmaxthis._x cF.xmax tb.xmin;
    if (
this._y tb.ymin cF.yminthis._y cF.ymin tb.ymax;
    if (
this._y tb.ymax cF.ymaxthis._y cF.ymax tb.ymin;    

Beispiel:
http://www.flashangel.de/mx/fsconstrain.swf

Download:
http://www.flashstar.de/tutlist/