# Flash 6 Help!- importing data into array and matching it to case switch

**URL:** <https://forum.kirupa.com/t/flash-6-help-importing-data-into-array-and-matching-it-to-case-switch/318902>\
**Category:** flash\
**Created:** [February 3, 2011, 5:01am UTC](https://forum.kirupa.com/t/flash-6-help-importing-data-into-array-and-matching-it-to-case-switch/318902 "2011-02-03T05:01:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mengaz](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mengaz](https://forum.kirupa.com/u/mengaz)\
**Post date:** [February 3, 2011, 5:01am UTC](https://forum.kirupa.com/t/flash-6-help-importing-data-into-array-and-matching-it-to-case-switch/318902/1 "2011-02-03T05:01:57Z")

</div>

Hi, I am new to flash and came across your forum while trying to solve an issue I have with flash.

A quick review of the project, I am importing information from an xml file into an array. From there I have passed the information from the array to a variable.

I find it that when I try to match the variable to a string letter, that it is not running through the case switch properly and going straight to the default bit. I have tried numerous solution to check where the problem lies;

I have trace the actual position of the array to check if it is the correct letter I am trying to match.  
Did a length check on the variable that it is only 1, and not containing any spaces  
When I hardcode the letter into the variable, the case works perfectly.

Any idea on why this is happening would greatly be apreciated. I have pasted a sample of the code below;

var switchTest = initialSlide\_array[1];

switch (switchTest) { //switch case used to check template type  
case “A”:  
trace(“template A”);  
template\_A(); // calls template function  
break;  
case “B”:  
trace(“template B”);  
break;  
case “C”:  
trace(“template C”);  
break;  
default :  
trace(“testing case default”);  
break;  
}//end of switch case statement
