5 Replies Latest reply on Dec 26, 2008 10:30 AM by ntsiii

    I need help please


      I am trying to get this code to run and am getting error #1119: Access of possibly undefined property height through a reference with static type Class. My code is below, any input would be great.
        • 1. Re: I need help please
          ntsiii Level 3
          First, please use descriptive subjects for all posts. Many contributors will ignore "Help Me" posts.

          Next, which line is throwing the error?

          • 2. Re: I need help please
            pr-flex Level 1

            Thanks for the info! The code that is throwing the is

            var cv:Canvas = new Canvas();
            cv.width = canvasWidth; <------------- I get the error here
            cv.height = canvasHeight;
            • 3. Re: I need help please
              ntsiii Level 3
              Ok, in your original post you show:
              cv.width = Canvas.width;
              This will cause the error because you are trying to get "width" from "Canvas". "Canvas" is a data type (Class), and you cannot access properties of a class, only of an *instance* of that class.

              Where are you wanting to get the value for the width and height from?

              Change the line to:
              cv.width = 200;
              The error will go away.

              • 4. Re: I need help please
                pr-flex Level 1
                here is the code that i started with, I am trying to get the canvas width from the image rss feed from photobucket.

                public function addURL(url:String) : void {
                Creates a canvas to display the image on
                and adds the canvas with the image as a
                Child of the coverflow component
                var cv:Canvas = new Canvas();
                cv.width = canvasWidth;
                cv.height = canvasHeight;
                var thisImage:Image = new Image();
                thisImage.addEventListener(Event.COMPLETE, imageLoaded);
                scrollbar.scrollPosition=coverflow.selectedIndex = Math.round(scrollbar.scrollPosition);
                coverflow.selectedIndex = numChildrenAdded-1;

                private function imageLoaded(event:Event):void{
                Image Loader function to center the image
                after it has been loaded
                var thisImage:Image = event.target as Image;
                if(thisImage.contentWidth>(canvasWidth-20) || thisImage.contentHeight>(canvasHeight-10)){
                var scaleAmt:Number = 1.0;
                scaleAmt = canvasWidth /(pbImg.contentWidth-10);
                scaleAmt = canvasHeight /(pbImg.contentHeight-10);
                pbImg.scaleX = scaleAmt;
                pbImg.scaleY = scaleAmt;
                • 5. Re: I need help please
                  ntsiii Level 3
                  Where is "canvasWidth" getting set? Have you determined that it has a value?

                  And that code is not giving the reference error you posted originally, is it?