1180:调用可能未定义的方法Point

时间:2011-03-16 11:10:44

标签: actionscript-3 blackberry-playbook

我对Blackberry Playbook的ActionScript 3.0开发非常新。

我正在使用Double Sided 3D Plane in FP10,我在使用此代码时遇到了麻烦:

package
{
    import flash.display.Sprite;
    import flash.events.Event;

    public class FlipCard extends Sprite
    {
        private var myPaperSprite:PaperSprite;

        public function FlipCard()
        {
            super();
        }

        private function Flip():void 
        {
            /*
            Create a new PaperSprite:

            If your front and back faces already exist, you can pass them straight
            into the constructor, like so:

            myPaperSprite = new PaperSprite( myFrontMc, myBackMc );
            */

            myPaperSprite = new PaperSprite();

            /*
            Optionally specify a pivot point, in this example the centre is used
            (this is also the default so there is no need to set this normally).

            To pivot around the top left use:
            myPaperSprite.pivot = new Point(0,0);

            or for bottom right:
            myPaperSprite.pivot = new Point(1,1);

            and so on...
            */

            myPaperSprite.pivot = new Point(0.5,0.5);

myPaperSprite.pivot = new Point(0.5,0.5);抛出以下错误:

1180: Call to a possibly undefined method Point.

枢轴成员的定义如下:

package
{
    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Point;
    import flash.geom.Rectangle;

    public class PaperSprite extends Sprite
    {

        //___________________________________________________________
        //————————————————————————————————————————————— CLASS MEMBERS

        private static const POINT_A:Point = new Point(0,   0);
        private static const POINT_B:Point = new Point(100, 0);
        private static const POINT_C:Point = new Point(0, 100);

        private var _isFrontFacing:Boolean = true;
        private var _autoUpdate:Boolean = true;
        private var _pivot:Point = new Point(0.5,0.5);

        private var _front:DisplayObject;
        private var _back:DisplayObject;

        private var _p1:Point;
        private var _p2:Point;
        private var _p3:Point;

        //___________________________________________________________
        //————————————————————————————————————————— GETTERS + SETTERS

        /**
         * A Point Object used to determine the pivot, or registration point of the 
         * PaperSprite. The values should be between 0 and 1 and are relative to the 
         * dimensions of each face, 0 being far left (on the x axis) or top (y axis) 
         * and 1 being the far right (x axis) or bottom (y axis).
         * 
         * The default value is { x:0.5, y:0.5 } meaning that both faces will pivot
         * around their respective centres
         * 
         * Examples:
         * 
         * To pivot from the centre use: new Point( 0.5, 0.5 );
         * To pivot from the top left use: new Point( 0.0, 0.0 );
         * To Pivot from the bottom right use: new Point( 1.0, 1.0 );
         * 
         */

        public function get pivot():Point
        {
            return _pivot;
        }

        public function set pivot( value:Point ):void
        {
            _pivot = value;
            alignFaces();
        }

问题出在哪里?我做错了什么?

1 个答案:

答案 0 :(得分:3)

import flash.geom.Point添加到 FlipCard.as ,因为它在该类中不可见