Question

I'm very very new on ActionScript 3.0 development for Blackberry Playbook.

I'm working with Double Sided 3D Plane in FP10 and I'm having troubles with this code:

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);

line myPaperSprite.pivot = new Point(0.5,0.5); is throwing the following error:

1180: Call to a possibly undefined method Point.

And pivot member is defined as follows:

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();
        }

Where is the problem? What am I doing wrong?

Was it helpful?

Solution

add import flash.geom.Point to FlipCard.as as well, as it is not visible in that class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top