Hi all,
Im loading an array of text and the problem right now is that if I want to remove the whole array i need to use several removes and thats not what i want. So I put everything into a container and want to remove the container but it doesn’t work only the last object in the array gets removed when i run the swf. Below is my code:
//variables for ContinentLocations
var ContinentsLoader:URLLoader = new URLLoader();
var Container:MovieClip = new MovieClip();
public function ContinentLocation(){
ContinentsLoader.load(new URLRequest("continentlocations.xml"));
ContinentsLoader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event):void
{
xmlData=new XML(e.target.data);
var HotelContintent:Array = new Array(xmlData.continent1, xmlData.continent2, xmlData.continent3, xmlData.continent4, xmlData.continent5, xmlData.continent6, xmlData.continent7);
var ContinentFormat:TextFormat = new TextFormat();
ContinentFormat.font = myFont.fontName;
ContinentFormat.size = 13;
var textArray:Array = new Array();
//var HotelContintent:Array = new Array();
for (var i:int; i < HotelContintent.length; i++) {
Container = new MovieClip();
addChild(Container);
var ContinentText:TextField = new TextField();
ContinentText.defaultTextFormat = ContinentFormat;
ContinentText.textColor = 0x7e7e7e;
ContinentText.selectable = false;
ContinentText.name = HotelContintent*;
ContinentText.text = HotelContintent*;
ContinentText.x = 50;
ContinentText.y = 40+i*20;
ContinentText.addEventListener(MouseEvent.CLICK, processContinent);
Container.addChild(ContinentText);
textArray.push(ContinentText);
}//end of for (var i:int; i < 3; i++) {
function processContinent(e:MouseEvent):void{
if (e.target.name == 'North America'){
removeChild(Container);
na_locations();
}
if (e.target.name == 'Latin America'){
la_locations();
}
if (e.target.name == 'Europe'){
eu_locations();
}
if (e.target.name == 'Common Wealth Of Independed States'){
cois_locations();
}
if (e.target.name == 'Middle East'){
me_locations();
}
if (e.target.name == 'India'){
in_locations();
}
if (e.target.name == 'Asia-Pacific'){
ap_locations();
}
}//end of function processReturn(event:Event):void{
}//end of function onComplete
}//end of public function HotelLocations(){
If i click on North America like I said it just only removes the last one. So could someone please explain me how the hell this is possible?
Greets,
Wouter