Pessoal, estou customizando um canvas redimensionável e estou com umas
dificuldades.

Peguei este 
componente<http://www.flexer.info/2008/04/25/resizable-canvas-horizontally/>que
faz um canvas ser redimensionável horizontalmente usando um botão do
lado direito.

Eu preciso que o canvas seja redimensionável para os dois lados
independentemente. Então coloquei um botão do lado esquerdo:

[image: resizableCanvas.png]

O evento disparado é o ENTER_FRAME, e a função que trata este evento é a
seguinte:

private function handleDragMove(event:Event):void
        {
            if (_dragStarted)
            {
                movement = (stage.mouseX - _dragStartPosition);
                if (getStyle("horizontalCenter") != undefined)
                {
                    movement *= 2;
                }
                trace((event.currentTarget as Button).label);

esse if era pare ser executado somente se o botao da esquerda estivesse em
ação de drag
      if ((event.currentTarget as Button).label == "left") {
                    if (movement <= 0)
                    {
                        // check not to pass the maximum width
                        if (maxWidth < _dragLastWidth - movement) {
                            width = _dragLastWidth - movement;
                            this.x = this.x + movement;
                        } else {
                            width = maxWidth;
                        }
                    } else {
                        // check not to pass the minimun width
                        if (minWidth > _dragLastWidth - movement) {
                            width = _dragLastWidth - movement;
                            this.x = this.x + movement;
                        } else {
                            width = minWidth;
                        }
                    }
e o else era pare ser executado somente se o botao da direita estivesse em
ação de drag
                } else {
                    // if we move to the left
                    if (movement <= 0)
                    {
                        // check not to pass the minimum width
                        if (minWidth < _dragLastWidth + movement)
                            width = _dragLastWidth + movement;
                        else
                            width = minWidth;
                    } else {
                        // check not to pass the maximum width
                        if (maxWidth > _dragLastWidth + movement)
                            width = _dragLastWidth + movement;
                        else
                            width = maxWidth;
                    }
                }
            }
        }

Mas não estou sabendo fazer para isolar cada parte da função. O evento é
disparado por ambos os botões ao mesmo tempo.
Se não ficou claro posso explicar melhor;

--
Diénert

-- 
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para 
[email protected]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev

Responder a