A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: xml node can I use Cdata?

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127

    xml node can I use Cdata?

    Hi,
    I am using CDATA with success in my xml but now the client wants to apply it to the Node Title, see the xml sample below. There are multiple <picture> values per node.
    Do I need to add a field to the xml for title and change my flash file to display that, or can I allow formatting of "Title"? using CDATA somehow?
    PHP Code:
    <node title="ABOUT">
            <
    picture>
                <
    menu_label>ABOUT</menu_label>
                <
    thumb>About.jpg</thumb>
                <
    img>img/images/USBank/About.swf</img>
                <
    desc_head_label>CAMPAIGN:</desc_head_label>
                <
    desc_headDichos</desc_head>
                <
    client_labelCLIENT:</client_label>
                <
    client_name>US BANK </client_name>
                <
    sector_label>SECTOR:</sector_label>
                <
    sector>BANKING</sector>
                <
    desc_label>DESCRIPTION:</desc_label>
                <
    desc><![CDATA[This is HTML formatted text which can support links 1 Lorem ipsum dolor sit amet ...]]> </desc>
                <
    collab_label1>ILLUSTRATOR:</collab_label1>
                <
    collab_name1>Phyllis Jones</collab_name1>
                <
    collab_label2>COPY WRITER:</collab_label2>
                <
    collab_name2>Lance Armstrong</collab_name2>
                <
    collab_label3>VIDEOGRAPHER:</collab_label3>
                <
    collab_name3>Aberto Mussolini</collab_name3>
                <
    link>http://www.gasolicious.com</link>
            
    </picture>
            
            </
    node
    thanks Mark

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    As far as I know you cant use CDATA for attributes. You will have to create a new Node and change your flash file
    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

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    I had the code working with the attribute, now I am trying to get it to work with a tag. I would really appreciate some help, supposed to go live tomorrow
    Thanks Mark

    Here is a simple version of my xml and my button AS3
    PHP Code:
        <node title="ABOUT">
            <
    picture>
                <
    menu_label><![CDATA[ABOUT | <font color="#0073B2">SPANISH</FONT>]]></menu_label>
                <
    thumb>1.jpg</thumb>
                <
    img>img/images/USBank/About.swf</img>
                <
    desc_label>DESCRIPTION:</desc_label>
                <
    desc><![CDATAsome formatted stuff ]]> </desc>
            </
    picture>        
            </
    node
    here is the code that sets up the menu buttons
    the commented out line is the one that successfully fed the node TITLE to the button.
    Now I would like to feed it <menu_label>so I can use CDATA.
    Do I need to have menu label defined in every <picture>?
    I can not get it to appear, my buttons are blank
    here is the AS3 code
    PHP Code:
    private function initButtonsLeft():void {//we attach all buttons from left and give them actions for roll over, out and press
                
    for (var j:int 0xml.node.length(); j++) {
                    var 
    but:btn = new btn();//btn is the movieclip from library, attached auto
                    
    but.* (but.height);
                    
    menu_container.addChild(but);
                    
    but.buttonMode true;
                    
    but.txt_mc.txt.selectable  false;
                    
    but.mouseChildren false;
                    
    //var txtName:String = xml.node[j].@title;//title assigned from xml
                    
    var txtName:String xml.node.picture.menu_label//my attempt
                    
    but.txt_mc.txt.htmlText txtName.toUpperCase();
                    
    but.id j;
                    
                    
    but.addEventListener(MouseEvent.ROLL_OVERoverBtn);
                    
    but.addEventListener(MouseEvent.ROLL_OUToutBtn);
                    
    but.addEventListener(MouseEvent.CLICKclickBtn);                
                }                
                
                
    initThumbs(1);//first gallery initialized
            


  4. #4
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Doh!!!!!

    Just got it working
    PHP Code:
    var txtName:String xml.node[j].picture.menu_label//title assigned from xml 

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