Passing a variable to my MovieClip - should be simple!

Hello All,

Thanks in advance for your help.

I am trying to send a value from one of my xml nodes (<marker>) by declaring it in a function ‘showData’ as a variable ‘XMLMarker’. If I trace this value (XMLmarker) it returns the right data found in the node <marker> (which is ‘myMarker_mc’). However, I need to tell the stage that myMarker_mc is a MovieClip…please see the ‘PROBLEM’ stated in the code below.

var placesXML:XML = 
    <place name= "Yogyakarta">
        <Data>This is a delightful place in Java</Data>
    <place name= "Banda_Aceh">
        <Data>This is a delightful place in Northern Sumatra</Data>

    and so on....

        <place name= "Gili_isles">
        <Data>This is a delightful place in Singapore</Data>

var nameBtn:Array  = [Yogyakarta, Banda_Aceh, Bengkulu, Singapore_City, Dili, Jakarta, Taipei, Manila, Hanoi, Vientiane, Phnom_penh, Napyidaw, Bangkok, Kuala_lumpar, Bandar_seri_sagawan, solo, Gili_isles]; 
var  i:int = nameBtn.length; 
    nameBtn*.addEventListener(MouseEvent.CLICK, showData);

*//The above part all works well...*

function showData(e:MouseEvent):void{
    var xmlFrame:int = placesXML.*.(@name ==; *//works fine*
    var xmlMarker:XMLList = placesXML.*.(@name ==; *//This returns myMarker_mc - perfect!    *
    var XMLmarkers:String = xmlMarker.toString();*//This also returns myMarker_mc, except now its a String - great!    *
       var xmlData:XMLList = placesXML.*.(@name ==; *//works fine*
    gotoAndStop(xmlFrame);//This works perfectly.
    XMLmarkers.myText.htmlText = xmlData.toString();*//PROBLEM - Now when the XMLmarkers variable is traced, it no longer shows 'myMarker_mc'. (What is shown is in the Code box further down this post)This line should activate the MovieClip (currently called 'myMarker_mc' on the stage). Within this movieclip there is a Dynamic textfield (called 'myText') and the text to go within this textfield comes from the variable (xmlData). *

You may ask, why do you want a variable to hold the value in the node , when that value is identical for each node, ie. it is always ‘myMarker_mc’, so why not just directly declare the variable ‘xmlMark’ as myMarker_mc. The reason is; the value in some of the nodes will soon be changing to ‘myMarker_mc2’ - a slightly different movieClip which I may need to call depending upon which place @name is chosen.

This is the new output thrown up by the variable XMLmarkers

    <htmlText>&lt;p align="center"&gt;&lt;font size="4"&gt;&lt;font color="#CBB9AB"&gt;&lt;b&gt;INDONESIA&lt;/b&gt;&lt;font color="#000000"&gt; ……………. &lt;/p&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#6259DF"&gt;&lt;p align="left"&gt;&lt;font size="2"&gt;&lt;b&gt;ABOUT&lt;/b&gt;&lt;br&gt;&lt;font color="#000000"&gt;……………………….......&lt;br&gt;&lt;br&gt;&lt;font color="#6259DF"&gt;&lt;b&gt;ATTRACTIONS&lt;/b&gt;&lt;br&gt;&lt;font color="#000000"&gt;Most travellers either spend their precious time elsewhere, or use this town for it’s transport connections.&lt;br&gt;&lt;br&gt;&lt;font color="#6259DF"&gt;&lt;b&gt;TRANSPORT&lt;/b&gt;&lt;br&gt;&lt;font color="#161672"&gt;&lt;i&gt;Air: &lt;/i&gt;&lt;font color="#000000"&gt;There is no airport here.&lt;br&gt;&lt;br&gt;&lt;font color="#161672"&gt;&lt;i&gt;Road: &lt;/i&gt;&lt;font color="#000000"&gt; where (Type, Duration, Cost), where (Type, Duration, Cost)&lt;br&gt;&lt;br&gt;&lt;font color="#161672"&gt;&lt;i&gt;Train: &lt;/i&gt;&lt;font color="#000000"&gt;There is no station here.&lt;br&gt;&lt;br&gt;&lt;font color="#4DFF00"&gt;&lt;b&gt;Sponsored Links&lt;/b&gt;&lt;br&gt;&lt;font color="#000000"&gt;&lt;a href=""&gt;&lt;u&gt;&lt;i&gt;Advertise&lt;/i&gt;&lt;/u&gt;&lt;/a&gt; with us&lt;br&gt;&lt;br&gt;&lt;font color="#6259DF"&gt;&lt;b&gt;Further Information&lt;/b&gt;&lt;br&gt;&lt;font color="#000000"&gt;&lt;a href=""&gt;Click &lt;u&gt;here&lt;/u&gt; to visit the BBC’s Weather page for Indonesia&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=""&gt;&lt;u&gt;FCO&lt;/u&gt; – Click for British Nationals travel requirements&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=""&gt;&lt;u&gt;World Health Organisation&lt;/u&gt; – Click for news on Indonesia&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=" "&gt; &lt;u&gt; Off Home Page…&lt;/u&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#FD2424"&gt;&lt;b&gt;Notes&lt;/b&gt;&lt;br&gt;&lt;font color="#000000"&gt;   Different areas present different risks, but travellers should remain vigilant within tourist-populated areas, as these have traditionally presented themselves as targets to Terrorist Groups.&lt;br&gt;&lt;br&gt;   Petty Crime such as pick-pocketing, or theft does exist and tourists remain particularly vulnerable upon public transport, whilst walking backstreets alone, and especially if high value items are displayed.&lt;br&gt;&lt;br&gt;   Travellers should also be aware of localised political situations as violence has occasionally followed rallies and demonstrations.&lt;br&gt;&lt;br&gt;   Travellers should also be aware of Muslim practices and be careful not to cause offence whilst visiting different parts of Indonesia – this is particularly prevalent during the month of Ramadan. &lt;br&gt;&lt;br&gt;   If you plan on Driving in Indonesia, please obtain a valid international Driving Licence. &lt;br&gt;&lt;br&gt;   Due to Indonesia’s geographical position, the area is particularly susceptible to flash flooding, earthquakes and volcanic activity – this often results in impassable transport routes.  &lt;br&gt;&lt;br&gt;&lt;font color="#6259DF"&gt;&lt;a ef="http//"&gt;&lt;u&gt;&lt;b&gt;Disclaimer&lt;/b&gt;&lt;/u&gt;&lt;/a&gt;&lt;/p&gt;</htmlText>


Please help!