bitwise shift

<< is an operator (bitwise shift). It converts expression1 and expression2 to 32-bit integers, and shifts all of the bits in expression1 to the left by the number of places specified by the integer resulting from the conversion of expression2. The bit positions that are emptied as a result of this operation are filled in with 0. Shifting a value left by one position is the equivalent of multiplying it by 2.

Example
x = 1 << 10 //the integer 1 is shifted 10 bits to the left

The result of this operation is x = 1024. This is because 1 decimal equals 1 binary, 1 binary shifted left by 10 is 10000000000 binary, and 10000000000 binary is 1024 decimal.


x = 7 << 8 //the integer 7 is shifted 8 bits to the left

The result of this operation is x = 1792. This is because 7 decimal equals 111 binary, 111 binary shifted left by 8 bits is 11100000000 binary, and 11100000000 binary is 1792 decimal.

bitwise OR

| is an operator (bitwise or). It converts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits of either expression1 or expression2 are 1.

Example
// 15 decimal = 1111 binary
x = 15;
// 9 decimal = 1001 binary
y = 9;
trace(x | y);
// 1111 | 0011 = 1111
//  returns 15 decimal (= 1111 binary)

  1. //stop the playhead
    ________________________
    
    //create a variable named maxPoints and set it to a number between 20 and 40
    _______________________
    
    //create a variable named points and set it to a new Array(), 
    //which means a list
    _________ = new Array();
    
    
    //create a variable named midPoints and set it to a new Array(), 
    _________________________
    
    
    //define the onMouseUp function
    _root.__________=function(){
    
    //create a variable named red and set it to a random
    //number between 0 and 255 
    _____=Math.floor(Math.random()*256);
    
    //create a variable named green and set it to a random
    //number between 0 and 255 
    ______________________________
    
    //create a variable named blue and set it to a random
    //number between 0 and 255 
    _____________________________
    
    /*  bitwise shift
    To get a random color you will use the << operator with the | to get a random 
    number*/
    
        //create a variable named col and set it to (red shifted left 16) bitwise OR
        //green shifted left 8 bitwise OR blue 
        _______ = red <<16 | ____________ | blue;
        
        
        //create a variable named colors and set it to 
        //col
        _____________________
        
        //Now that you have a color ppour the paint
        pourPaint();
    }
    
    //define pourPaint()
    function pourPaint(){
    //create a for loop that continues as long as 
    //i is less than the variable holding the maximum number of points
    //see line 5
        for (i=0; i<_______; i++) {
        
        //each element in the points array is another array
        points[i] = {x:i*550/(maxPoints-1), y:Math.random()*70+10, vy:Math.random()*50+1};
    }
    //create a for loop that continues as long as 
    //i is less than the variable holding the maximum number of points minus 1
    for (i=0; i<_________; i++) {
    
    //set each element in midPoints to x:0,y:0
        midPoints[i] = {_________};
    }
    
    //define onEnterFrame
    _root.______________ = function () {
    
    //create a for loop that continues as long as 
    //i is less than the the length of the points array
    
        for (i=0; i<______.length; i++) {
        //set the y property of each element of points to itself plus the vy property of the same 
        //element of the points array
            points[i].y += __________________;
        }
        
    //create a for loop that continues as long as 
    //i is less than the the length of the points array minus 1
        
        for (i=0; i<________________; i++) {
        //set the x property of each element of the midpoints array to 
        //half of the x property of the same element of the points array plus the x property of the next 
        //element of the points array
            midpoints[i].x = (points[i].x+points[i+1].x)/2;
            
         //set the y property of each element of the midpoints array to 
        //half of the y property of the same element of the points array plus the y property of the next 
        //element of the points array
         ____________________________________
        }
        
        
        clear();
        //set the lineStyle() to 1 pixel, black and 0 alpha
        //lineStyle([thickness[, rgb[, alpha]]])
        lineStyle(____________);
        
        //set beginFill() to the color selected previously and 100 alpha
        //beginFill([rgb[, alpha]])
        beginFill(_________);
        
        //call the moveTo() method to move the point to the first point of the points array
        moveTo(points[0].x, __________);
        
        //create a for loop that continues as long as 
        //i is less than the the length of the points array minus 2
    
        for (i=1; <_____________; i++) {
        
        //call the curveTo draw a curve using the current line style 
        //starting at the current drawing position to (anchorX, anchorY) 
        //using the control point specified by (controlX, controlY). 
        //The current drawing position is then set to (anchorX, anchorY). 
        
        //fill in the y
            curveTo(points[i].x, __________, midPoints[i].x, ___________);
        }
        
        //this finishes the curve
        //fill in the x
        curveTo(____________, points[i].y, ____________, points[i+1].y);
        
        //Using lineTo move the line to the top right corner
        lineTo(550, ____);
        
        //Using lineTo move the line to the top left corner
        lineTo(________);
        
        //Using lineTo move the line to the first point in the points array
        lineto(______________);
        
        //Call endFill() to complete the fill 
        _________________
        };
    }