# Place random lights on skyline and turn the lights on and off

**URL:** <https://forum.kirupa.com/t/place-random-lights-on-skyline-and-turn-the-lights-on-and-off/318134>\
**Category:** Uncategorized\
**Created:** [January 11, 2011, 12:10pm UTC](https://forum.kirupa.com/t/place-random-lights-on-skyline-and-turn-the-lights-on-and-off/318134 "2011-01-11T12:10:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![talgroenman](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@talgroenman](https://forum.kirupa.com/u/talgroenman)\
**Post date:** [January 11, 2011, 12:10pm UTC](https://forum.kirupa.com/t/place-random-lights-on-skyline-and-turn-the-lights-on-and-off/318134/1 "2011-01-11T12:10:45Z")

</div>

Hii all, I am new at AS3 and trying to make some game where you can see the skyline of new york. You have to turn the lights off as quik as possible.  
I hope some one can help me because i am stuck now. Hope someone can help me whit the right scrips on the end

> package  
> {  
> import flash.display.MovieClip;  
> import flash.external.ExternalInterface;  
> //Import the class needed to call a jQuery function  
> import flash.events.MouseEvent;  
> import flash.geom.Point;

//Import the class needed to detect a mouse click

```
public class Game2 extends MovieClip
{
    // list of windowposition
    var windowOnePositions:Array;
    
    public function Game2() : void
    {
        // making some array:
        // 3 windows
        // Get the list off positions for the single window (Point objecten: bv: new Point( 123, 456))
        
        windowOnePositions = new Array( new Point( 345, 180 ), new Point( 123, 256 ), new Point( 100, 100 ) )
        
        placewindow();
    }
    
    /**
     * functie that place a window
     */
    private function placewindow() :void
    {
        /*
        var placewindow:MovieClip = new raam1_mc();
        addChild( placewindow );
        placewindow.x = 345;
        placewindow.y = 180;
        */
        // variabele that place the window
        var window:MovieClip;
        // make variable where math.random =() (between 0 en 1 dus)
        var randomWaarde:Number = Math.random();
        // if window is lower then 0.5: then choose 1, else 2
        // 'raam1 choose = new raam1_mc() to make.
        if ( random &lt; 0.5 )
        {
            window = new raam1_mc()
            random window = windowOnePositions * 3 ;
            windowOnePositions = Math.floor();
            trace ("test" )
                                            
            // get a random number from position list
            // random number between 0 and 1
            // list is 3 long
            // * random number with the length from the list
            // Round number down (Math.floor())
            // take number to get from the list windowOnePositions[getRandomGetal], safe in variable
            // make window x-positie the same as the x positie from point from list[array] you get it in array
            // make window y-positie the same as the y positie from point from list[array] you get it in arra
            // aadchild( window )
           // when click on it disapear from screen
        }
        
    }
}

```

}

Hope someone can help me  
Its the same \*\*\* Wack a Mole Effect

Greetz Tal
