![]() |
|
||||||||||
|
|||||
|
Регистрация: Jul 2007
Сообщений: 44
|
Есть у меня такой класс:
class DraggableMovieClip extends MovieClip
{
private var left:Number;
private var top:Number;
private var right:Number;
private var bottom:Number;
private var dest:MovieClip;
public function DraggableMovieClip()
{
super();
this.left = undefined;
this.top = undefined;
this.right = undefined;
this.bottom = undefined;
this.dest = this;
this.onPress = __startDrag;
this.onMouseUp = __stopDrag;
this.onRelease = __stopDrag;
this.onMouseMove = updateAfterEvent;
}
public function setDragBoundaries(newleft:Number,newtop:Number,newright:Number,newbottom:Number):Void
{
this.left = newleft;
this.top = newtop;
this.right = newright;
this.bottom = newbottom;
}
public function setDestinationClip(newdest:MovieClip):Void
{
this.dest = newdest;
}
public function getDestinationClip():MovieClip
{
return this.dest;
}
public function doDrag():Void
{
this.dest.startDrag(false,this.left,this.top,this.right,this.bottom);
}
public function getPositionX():Number
{
return((2*this.dest._x-this.right-this.left)/(this.right-this.left));
}
public function setPositionX(newX:Number):Void
{
if( newX >= 1 )
{
this.dest._x = this.right;
}
else if( newX <= -1 )
{
this.dest._x = this.left;
}
else
{
this.dest._x = 0.5*(this.left+this.right) + newX*0.5*(this.right-this.left);
}
}
public function getPositionY():Number
{
return((2*this.dest._y-this.top-this.bottom)/(this.bottom-this.top));
}
public function setPositionY(newY:Number):Void
{
if( newY >= 1 )
{
this.dest._x = this.bottom;
}
else if( newY <= -1 )
{
this.dest._x = this.top;
}
else
{
this.dest._x = 0.5*(this.top+this.bottom) + newY*0.5*(this.bottom-this.top);
}
}
private function __startDrag():Void
{
this.dest.startDrag(false,this.left,this.top,this.right,this.bottom);
}
private function __stopDrag():Void
{
this.dest.stopDrag();
}
}
_root.createEmptyMovieClip("Ruler",_root.getNextHighestDepth());
_root.Ruler.attachMovie("EmptyDraggableMovieClipSymbol","DragPane",_root["Ruler"].getNextHighestDepth());
var mywidth:Number = 13000;
var __start:Number = -500;
var __end:Number = 2100;
var len:Number = __end - __start;
_root.Ruler.DragPane.setDestinationClip(_root.Ruler);
_root.Ruler.DragPane.setDragBoundaries(-0.5*mywidth,0,0.5*mywidth,0);
for( var i=__start ; i<__end ; i++ )
{
var j=(i<0)?(i):(i+1); // biologists forgot about ZERO
if( j%100 == 0 )
{
_root.Ruler.lineStyle(1,0x990000,100);
_root.Ruler.moveTo(-0.5*((len-1)*mywidth/len)+(i-__start)*(mywidth/len),100);
_root.Ruler.lineTo(-0.5*((len-1)*mywidth/len)+(i-__start)*(mywidth/len),80);
_root.Ruler.moveTo(-0.5*((len-1)*mywidth/len)+(i-__start)*(mywidth/len),-80);
_root.Ruler.lineTo(-0.5*((len-1)*mywidth/len)+(i-__start)*(mywidth/len),-100);
_root.Ruler.lineStyle(0,0x990000,25);
}
else if( j%10 == 0 )
{
_root.Ruler.moveTo(-0.5*((len-1)*mywidth/len)+(i-this.__start)*(mywidth/len),90);
_root.Ruler.lineTo(-0.5*((len-1)*mywidth/len)+(i-this.__start)*(mywidth/len),100);
_root.Ruler.moveTo(-0.5*((len-1)*mywidth/len)+(i-this.__start)*(mywidth/len),-90);
_root.Ruler.lineTo(-0.5*((len-1)*mywidth/len)+(i-this.__start)*(mywidth/len),-100);
}
}
_root.Ruler.DragPane.moveTo(0,0);
_root.Ruler.DragPane.beginFill(0x006600,50);
_root.Ruler.DragPane.lineTo(-0.5*mywidth,-100);
_root.Ruler.DragPane.lineTo(0.5*mywidth,-100);
_root.Ruler.DragPane.lineTo(0.5*mywidth,100);
_root.Ruler.DragPane.lineTo(-0.5*mywidth,100);
_root.Ruler.DragPane.lineTo(-0.5*mywidth,-100);
_root.Ruler.DragPane.endFill();
Что хочу получить: линейку, которая драгается. Что получается: примерно то, что хочу, только зелёная заливка исчезает при достижении опр. положения линейки. притом заливка не кончается, а именно исчезает. Линейку после этого даже не схватить. Что делать? Где искать проблему? В заливке? В коде? |
|
|||||
|
Регистрация: Jul 2007
Сообщений: 44
|
Кстати проблема изчезает, когда длина линейки меньше, скажем в 10 раз. Почему то заливка при драге загибается, если рисовать огромный прямоугольник, а потом его драгать.
Как с этим бороться??? |
![]() |
![]() |
Часовой пояс GMT +4, время: 02:58. |
|
|
« Предыдущая тема | Следующая тема » |
|
|