# Assigning with switch/ case

**URL:** <https://forum.kirupa.com/t/assigning-with-switch-case/219060>\
**Category:** Uncategorized\
**Created:** [March 13, 2007, 3:06pm UTC](https://forum.kirupa.com/t/assigning-with-switch-case/219060 "2007-03-13T15:06:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![puthem1st](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@puthem1st](https://forum.kirupa.com/u/puthem1st)\
**Post date:** [March 13, 2007, 3:06pm UTC](https://forum.kirupa.com/t/assigning-with-switch-case/219060/1 "2007-03-13T15:06:25Z")

</div>

Hi everyone,

I have a question about my setup that is not working. I have an array of movie clips that are placed on the stage (this works fine) but I want to give each movie clip a value so that I can check what the user types.

Ex.

```auto

[LEFT]_root.createEmptyMovieClip("Placement", 2);
var shapes:Array = new Array("square", "circle", "triangle");
function selectshape():String {
    //get the index for the letter
    var index:Number = random(shapes.length);
    //assign the letter to a var
    var s:String = shapes[index];
    //display letter
    return s;
}
trace(selectshape());
//calls the function that will place the shapes on the stage
pulltogether(shapes);
function pulltogether(test:Array) {
    for (var i = 0; i < test.length; i++) {
        Placement.attachMovie(shapes*, shapes*, i+10, {_x:random(200), _y:random(200)});
    }
}
 
 
var storedvalue:String;
 switch(storedvalue) {
  case "square" : 
   trace("square stored");
   storedvalue= "Red square";
   break;
  case "circle" : 
   trace("circle stored");
    storedvalue= "Blue circle";  
    break; 
case "triangle" : 
   trace("triangle stored");
    storedvalue= " Green triangle";  
    break; 
 
 [/LEFT]

```

Any help is appreciated! Thanks
