Displaying XML - please help!

Hello All,

Thanks for your help in advance! As a novice coder, I seemed to have reached an impasse!

stop ();
   
  var placesXML:XML = 
  <places>
                  <place name= "Bengkulu" frame= "63">
                                  <Data>This is a deliightful place in Sumatra</Data>
                  </place>
                  <place name= "Yogyakarta" frame= "62">
                                  <Data>This is a deliightful place in Java</Data>
                  </place>
                  <place name= "Banda_Aceh" frame= "64">
                                  <Data>This is a deliightful place in Northern Sumatra</Data>
                  </place>
  </places>
   
  var placeNo:Number;
  var place_mc:Array = [towns.Bengkulu, towns.Yogyakarta, towns.Banda_Aceh];
   
  for each (var place_btn in place_mc){
                  
                  place_btn.addEventListener(MouseEvent.CLICK, showData);
  }
   
  function showData(e:MouseEvent):void{
                  for (var i in place_mc){
                                  if (e.currentTarget.name==place_mc*.name){
                                                  gotoAndStop(placesXML.place*.placeNo);
                                                  mc_myMarker.myText = placesXML.place*.Data;
                                  }
                  }
  }
   
  //the script below controls the mc_myMarker movie clip and it currently works...
   
  function removeMarker(event:MouseEvent):void 
  {
                  gotoAndStop(61);
  }
   
  mc_myMarker.bt_remove.addEventListener(MouseEvent.CLICK, removeMarker);
   
  function scrollUp (Event:MouseEvent):void {
                  
                  mc_myMarker.myText.scrollV -= 1;
  }
   
  function scrollDown (Event:MouseEvent):void {
                  
                  mc_myMarker.myText.scrollV += 1;
  }
   
  mc_myMarker.bt_up.addEventListener (MouseEvent.CLICK, scrollUp)
   
  mc_myMarker.bt_dn.addEventListener (MouseEvent.CLICK, scrollDown)
  

The above code currently does not log any compiler errors, however the movie just loops through (does not stop as the first instruction) and displays this is the output panel;

TypeError: Error #1034: Type Coercion failed: cannot convert MapMovieClipJAN09_fla::grc_Towns_3@2d0f1a1 to flash.display.SimpleButton.
                  at flash.display::Sprite/constructChildren()
                  at flash.display::Sprite()
                  at flash.display::MovieClip()
                  at MapMovieClipJAN09_fla::Towns_grp_1()
                  at flash.display::Sprite/constructChildren()
                  at flash.display::Sprite()
                  at flash.display::MovieClip()
                  at MapMovieClipJAN09_fla::MainTimeline()
  TypeError: Error #1009: Cannot access a property or method of a null object reference.
                  at MapMovieClipJAN09_fla::MainTimeline/frame61()
  

What I am trying to acheive is basically;

  1. Stop the movie on the frame in which this AS is stored.
  2. Store all the movie clips (which I want to act as buttons) in the array at the top.
  3. When a user clicks on one of the movie clips (names of which are currently in the array), I want the AS3 to check for a match between the ‘name attribute’ within the xml and the name of the movie clip just clicked.
  4. Once the match is spotted, I want the user to be sent to the corresponding frame number (stored in xml as ‘frame attribute’) and the corresponding text (stored in the ‘Data’ element tags) to be displayed in ‘mc_myMarker.myText’.

This script was just a smaller version of a larger program - there would be over 200 movie clips acting as buttons in the final version (as oppose to the three above) and there and I would add a little HTML to the xml data and use the ‘HTMLText’ property.

Thanks for taking the time to read this post!

Cheers