4 Replies Latest reply on Dec 12, 2011 9:05 AM by SuperSonic65

    1120 - Access of undefined property

    SuperSonic65

      Hi-

      I'm new to Flash. I'm trying to create a basic slideshow that includes buttons for navigating the images, however, in my ActionScript, I've been getting the following error:

      Scene 1, Layer 'Actions', Frame 1, Line 27          1120: Access of undefined property photo1.

       

      I've attached the code below. Can you tell me what I'm doing wrong? Thanks.

      --------------------------------------

       

      //Import Tweener

      import caurina.transitions.Tweener;

      //Tweener.addTween(myMovie, {x:10, y:10, time:1, transition:"linear"});

       

       

      //Declare initial variables

      var currentPhoto:Number=1;

      var totalPhotos:Number=4

       

       

      //Set up initial properties

      //Turn off all photos

      Coffee1.alpha=0;

      Coffee2.alpha=0;

      Coffee3.alpha=0;

      Coffee4.alpha=0;

       

       

      rightArrow.alpha=0

      leftArrow.alpha=0

       

       

       

       

      //Fade in initial assets

      Tweener.addTween(Coffee1, {alpha:1, time:1.5, transition:"easeOutQuad"});

       

       

      Tweener.addTween(leftArrow, {alpha:.5,x:20, time:1, delay: 1.7, transition:"easeOutQuad"});

      Tweener.addTween(rightArrow, {alpha:.5,x:930, time:1, delay: 1.9, transition:"easeOutQuad"});

       

       

      rightArrow.buttonMode=true;

      rightArrow.useHandCursor=true;

      rightArrow.mouseChildren=false;

      rightArrow.addEventListener(MouseEvent.MOUSE_DOWN,nextPhoto);

      rightArrow.addEventListener(MouseEvent.MOUSE_OVER,fadeInRightArrow);

      rightArrow.addEventListener(MouseEvent.MOUSE_OUT,fadeOutRightArrow);

       

       

      leftArrow.buttonMode=true;

      leftArrow.useHandCursor=true;

      leftArrow.mouseChildren=false;

      leftArrow.addEventListener(MouseEvent.MOUSE_DOWN,prevPhoto);

      leftArrow.addEventListener(MouseEvent.MOUSE_OVER,fadeInLeftArrow);

      leftArrow.addEventListener(MouseEvent.MOUSE_OUT,fadeOutLeftArrow);

       

       

       

       

      //rightArrow functionality

      function nextPhoto(e:MouseEvent) {

                //trace("Event= "+e)

                //trace("this= "+this)

                //trace('this["photo"+currentPhoto]= '+this["photo"+currentPhoto])

                //trace('this["photo"+currentPhoto]= '+this["photo"+currentPhoto].name)

                Tweener.addTween(this["photo"+currentPhoto], {alpha:0, time:.5, transition:"easeOutQuad",onComplete:fadeNext});

      }

       

       

      function fadeNext() {

                //Increment the counter

                currentPhoto++;

                if (currentPhoto==(totalPhotos+1)){

                          currentPhoto=1

                }

                Tweener.addTween(this["photo"+currentPhoto], {alpha:1, time:.5, transition:"easeOutQuad"});

      }

       

       

      //Fade in when mouse is over rightArrow

      function fadeInRightArrow(e:MouseEvent) {

                Tweener.addTween(rightArrow, {alpha:1, time:.2, transition:"easeOutQuad"});

      }

       

       

      //Fade out when mouse is off rightArrow

      function fadeOutRightArrow(e:MouseEvent) {

                Tweener.addTween(rightArrow, {alpha:.5, time:.5, transition:"easeOutQuad"});

      }

       

       

       

       

      //leftArrow functionality

      function prevPhoto(e:MouseEvent) {

                Tweener.addTween(this["photo"+currentPhoto], {alpha:0, time:.5, transition:"easeOutQuad",onComplete:fadePrev});

      }

       

       

      function fadePrev() {

                currentPhoto--;

                if (currentPhoto==0){

                          currentPhoto=totalPhotos

                }

                Tweener.addTween(this["photo"+currentPhoto], {alpha:1, time:.5, transition:"easeOutQuad"});

      }

       

       

      //Fade in when mouse is over leftArrow

      function fadeInLeftArrow(e:MouseEvent) {

                Tweener.addTween(leftArrow, {alpha:1, time:.2, transition:"easeOutQuad"});

      }

      //Fade in when mouse is off leftArrow

      function fadeOutLeftArrow(e:MouseEvent) {

                Tweener.addTween(leftArrow, {alpha:.5, time:.5, transition:"easeOutQuad"});

      }