Skip to main content
May 9, 2010
Question

class property error #1013

  • May 9, 2010
  • 1 reply
  • 712 views

I'm customizing a floating panel that I found on gotoAndLearn.

I a keep having this error:

This topic has been closed for replies.

1 reply

Cancerinform
Inspiring
May 9, 2010

This error occurs when you have attributes at the wrong place. For example the private attribute cannot be used within a class function. Check the code you got for something like that. The error message must have told you what the problem is.

May 9, 2010

Thanks, I was just going to post.

I started from scatch and realized that it was mostly syntax, and placement within brackets, which were off. I am beginning to understand strict code.

It now works and I plan to customize it further.

I needed a good nights sleep

Attached is the current code:

package {

    import com.greensock.*;
    import com.greensock.easing.*;
    import flash.display.*;
    import flash.events.*;

    public class PhotoPanelsNew extends MovieClip
    {

        private var inFocus:MovieClip;

        public function PhotoPanelsNew():void
        {
            setupClips();
            addEventListener(Event.ENTER_FRAME, loop);
        }

        private function setupClips():void
        {
            var len:int = con.numChildren;
            for (var i:int=0; i<len; i++)
            {
               var mc:MovieClip = MovieClip(con.getChildAt(i));
               mc.buttonMode = true;
               mc.loc = [mc.x, mc.y];
               mc.addEventListener(MouseEvent.CLICK, onClick);
                                                            
            }
           
        }

        private function onClick(e:MouseEvent):void
        {
            var mc:MovieClip = MovieClip(e.currentTarget);
            if(inFocus == null)
            {
                scaleUp(mc);
            }
           
            else if(inFocus == mc)
            {
                TweenLite.to(inFocus, 0.5,{
                                scaleX:1,
                                scaleY:1,
                                x:inFocus.loc[0],
                                y:inFocus.loc[1],
                                x:0,
                                y:0,
                                ease:Expo.easeInOut,
                                onComplete:function(){inFocus=null;}
                             });
            }
            else
            {
                TweenLite.to(inFocus, 0.5,{
                                scaleX:1,
                                scaleY:1,
                                x:inFocus.loc[0],
                                y:inFocus.loc[1],
                                x:0,
                                y:0,
                                ease:Expo.easeInOut,
                                onComplete:scaleUp,
                                onCompleteParams:[mc]
                             });
            }
        }
       
        private function scaleUp(mc:MovieClip):void
        {
            inFocus = mc;
            con.addChild(mc);
            TweenLite.to(mc, 0.5,{
                                scaleX:3,
                                scaleY:3,
                                x:0,
                                y:0,
                                ease:Expo.easeInOut
                         });
        }

         private function loop(e:Event):void
        {
            var distx:Number=mouseX/1000;
            var disty:Number=mouseY/700;
            TweenLite.to(con, 1, {
                                   rotationY:(-60 + (120*distx)),
                                   rotationX:(60 - (120*disty)),
                                   ease:Expo.easeOut
                              });

        }
    }

}