Как повернуть компонент MXML вокруг его центра как колесо почтительно к мыши?

Таким образом, у меня есть та панель или любой другой компонент MXML. Я хочу так или иначе повернуть его вокруг подобного колесо автомобиля, с которым Вы управляете им... loke, Мчащееся колесо... сеют как то, когда кнопка мыши снижается, это получает понтонный мост компонента..., когда Вы перемещаетесь, компонент мыши вращается (не перемещения) согласно новому положению мыши... Как повернуть компонент MXML вокруг его центра как колесо почтительно к мыши?

welll не стесняются редактировать этот вопрос, потому что я знаю, что сформулировал его плохим способом...

1
задан Rella 16 June 2010 в 16:15
поделиться

2 ответа

Добавьте их в служебный класс, если вы не хотите добавлять зависимость к fl.motion. *

/**
     * Rotates a matrix about a point defined inside the matrix's transformation space.
     * This can be used to rotate a movie clip around a transformation point inside itself. 
     *
     * @param m A Matrix instance.
     *
     * @param x The x coordinate of the point.
     *
     * @param y The y coordinate of the point.
     *
     * @param angleDegrees The angle of rotation in degrees.
     * @playerversion Flash 9.0.28.0
     * @langversion 3.0
     * @keyword Matrix, Copy Motion as ActionScript    
     * @see flash.geom.Matrix         
     */
    public static function rotateAroundInternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number):void
    {
        var point:Point = new Point(x, y);
        point = m.transformPoint(point);
        m.tx -= point.x;
        m.ty -= point.y;
        m.rotate(angleDegrees*(Math.PI/180));
        m.tx += point.x;
        m.ty += point.y;
    }



    /**
     * Rotates a matrix about a point defined outside the matrix's transformation space.
     * This can be used to rotate a movie clip around a transformation point in its parent. 
     *
     * @param m A Matrix instance.
     *
     * @param x The x coordinate of the point.
     *
     * @param y The y coordinate of the point.
     *
     * @param angleDegrees The angle of rotation in degrees.
     * @playerversion Flash 9.0.28.0
     * @langversion 3.0
     * @keyword Matrix, Copy Motion as ActionScript    
     * @see flash.geom.Matrix       
     */
    public static function rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number):void
    {
        m.tx -= x;
        m.ty -= y;
        m.rotate(angleDegrees*(Math.PI/180));
        m.tx += x;
        m.ty += y;
    }

Это MatrixTransformer rotateAroundInternalPoint () и ] rotateAroundExternalPoint ()

Это было бы для 2d. Для 3d см. transformAround .

Не забудьте проверить, правильно ли обновляются элементы макета.

HTH

2
ответ дан 2 September 2019 в 23:44
поделиться

Я полагаю, что вы можете вращать компонент, используя свойства rotateX, rotateY и rotateZ:

http://docs.huihoo.com/flex/4/mx/core/UIComponent.html#rotationX

Просто сделайте это в ответ на щелчок мыши.

0
ответ дан 2 September 2019 в 23:44
поделиться
Другие вопросы по тегам:

Похожие вопросы: