A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: AS 2.0 Combo Box and XML

  1. #1
    Member
    Join Date
    Jan 2010
    Location
    Drobeta Turnu Severin
    Posts
    59

    AS 2.0 Combo Box and XML

    Hello. I have a problem involving a comboBox and a textBox. I need to import htmltext in the textBox when selecting the name of the person from the comboBox.
    I reached an impossible point now and I rather upload the files than continuing to try with no point to resolve this.

    Help will be much appreciated.
    Last edited by alex_popa_81; 07-10-2012 at 02:53 AM.

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    post it in Flash 8 format..

    also in yo u.xml file.. i dont see any HTML text?

    what is the text you want in the HTML text field?..

    and hat do you want displayed in the combobox? what is the:

    <combo>3</combo>
    <content>345</content>
    <icon>pdf.jpg</icon>

    <combo></combo> tags for?

  3. #3
    Member
    Join Date
    Jan 2010
    Location
    Drobeta Turnu Severin
    Posts
    59
    the comboBox loads text from inside the <combo> tags. The textBox loads the text inside the content tag.
    icon is easy to define, forget that line.
    HTML text will be defined in another function separately with a makeLinks function and inside the <content> tag I will have a CDATA text. That's easy also. I need to know just how to define the combo to retrive xml data from all the <combo> tags at once and populate the textBox when selecting one of the listed combo items.

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    well since you didnt want to post a FLASH 8, AS2 version for me to look at .


    all I can say is if you dont knwo how to load and parse XML ..there is a link in my footer

    beyond that once you have the XML loaded/parsed and attached to the items/data in the combo box...

    you will need to use an onCHange event handler to watch for what item is chosen in the combobox..and then use its attached 'data' to display in the text field.

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    Replace your as code with:

    Code:
    var smth=0;
    textBox.html=true;
    var myXML1 = new XML();
    myXML1.ignoreWhite=true;
    myXML1.onLoad = function(success) {
    	if(success) {
    		pop();
    	}
    	
    	
    }
     
     
    function updateContent()
    {
    	textBox.htmlText = comboBox.value[0]["txtContent"];
    	loadMovie(comboBox.value[0]["image"], iconBox)
    }
     
     
    myXML1.load("1.xml");
     
    function pop()
    {
    	rootNode = myXML1.firstChild;
    	
    	for(var i:Number = 0; i < rootNode.childNodes.length; i++)
    	{
    		comboLabel = rootNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    		comboBox.addItem({label:comboLabel, data:[{txtContent:rootNode.childNodes[i].childNodes[1].firstChild.nodeValue, image:rootNode.childNodes[i].childNodes[2].firstChild.nodeValue}]}) 
    	}
    	
    	comboBox.addEventListener("change", updateContent);
    	updateContent();
    }

    You can define your underline in the XML file itself:

    Code:
    <![CDATA[ 234  and this is a <u><a href='http://www.hotmail.com'>link</a></u> ]]>
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center