Skip to main content
Participant
July 28, 2009
Question

1046: Type was not found or was not a compile-time constant: unit.

  • July 28, 2009
  • 2 replies
  • 1490 views

i have this error in my coding

package{
   
    import flash.display.MovieClip;
    import flash.geom.ColorTransform
    import flash.events.*;
   
    //this class represents the Star movie clip we drew on the stage.
    //we extend this class to a movie clip, thus allowing us to use movie
    //clips functions and properties
   
    public class Star extends MovieClip{
       
this line is where issue is        [private var starColor:uint;]
        private var starRotation:Number;
       
        /*this is called the constructer of the class
        it is alled everytime we create a new Star instance.
        in the constructor, we assign a random colour to the star and set some of its
        properties */
       
        public function Star(){
           
            //calculate a random colour
            this.starColor=Math.random() * 0xffffff;
           
            //get access to the ColorTransform instance associated
            //with star
            var colorInfo:ColorTransform =
            this.transform.colorTransform;
           
            //set the color of the ColorTransform object
            colorInfo.color=this.starColor;
           
            //apply the color to the star
            this.transform.colorTransform=colorInfo;
           
            //assign a random alpha for the star
            this.alpha=Math.random();
           
            //assign a random rotation speed
            this.starRotation=Math.random() * 10-5;
           
            //assign a random scale
            this.scaleX = Math.random();
            this.scaleY = this.scaleX;
           
            //add enter_frame where we do the animation
            addEventListener(Event.ENTER_FRAME,rotateStar);
        }
       
        //this function is responsible for he rotation of the star
        private function rotateStar(e:Event):void {
            this.rotation += this.starRotation;
        }
    }
}

help would be much appreciated

This topic has been closed for replies.

2 replies

Ned Murphy
Legend
July 28, 2009

If the title of your posting is the copied error message, you would appear to have a uint mispelled as unit somewhere.

kglad
Community Expert
Community Expert
July 28, 2009

copy and paste your error message.