6 Replies Latest reply on May 13, 2007 11:47 PM by proPingu

    Load External Text into Flash MX

    want-mac
      Hi,

      I know we can load text files into flash externaly, but here i want that to appear once we mouse over, ie i want the external text file to appear once we rollover a text or a object.

      Thanks.
        • 1. Re: Load External Text into Flash MX
          want-mac Level 1
          Something like -
          http://207.97.249.60/

          but here I want the rollover text should be a external file so that i can modifiy later easy
          • 2. Load External Text into Flash MX
            Armen Abrahamyan Level 1
            You have to load texts from beginning ( all in one xml file will be better choice i think), and after show tooltip once buttons or ur objects are rollOvered.
            • 3. Re: Load External Text into Flash MX
              want-mac Level 1
              I have a text file named "testing.txt" now i want the this text file to open up when i roll my mouse over a something say square or circle and it should go off when i take my mouse out of that square or the circle.

              for now i writing this code -

              myData = new LoadVars();
              myData.onLoad = function() {
              myText_txt.text = this.content;
              };
              myData.load("testing.txt");

              stop();

              but with this code the text file open only when a image in loaded and not while rollover.
              • 4. Re: Load External Text into Flash MX
                proPingu
                First creat XML file

                //// .XML file code ////
                <?xml version="1.0" encoding="UTF-8"?>
                <Pageinfo>
                <content>
                <op1id="Booth 264" op2id="20'X10'" op3id="200sq.ft" >Assurrat Solutions</qu>
                <op1id="Booth 276" op2id="10'X10'" op3id="100sq.ft" >PropertyBoss Solutions</qu>
                </content>
                </Pageinfo>

                ////

                then XML file load into Fla

                //// XML load on frame ////

                var my_xml:XML = new XML();
                my_xml.ignoreWhite = true;
                my_xml.onLoad = function(success:Boolean) {
                trace("success: "+success);
                trace("loaded: "+my_xml.loaded);
                trace("status: "+my_xml.status);
                };
                my_xml.load("www.flash-mx.com/mm/problems/products.xml");


                //// Button script ////

                my_btn.onRollOver=function (){
                trace ("call XML nodeValue");
                }

                More info:-
                Find in Flash Help, under ActionScript 2.0 Language Reference,
                ActionScript classes > XMLNode >
                • 5. Re: Load External Text into Flash MX
                  Lost by the Lake
                  Is there any way to do this without having to go into XML? I've been trying the same thing using the following code:

                  //--Load Description--\\

                  //create new LoadVars instance
                  my_lv = new LoadVars();

                  //Load external text file
                  my_lv.load("text/descriptions.txt");

                  //Retreive value for player description and hold
                  my_lv.getplayerDescription = function() {
                  return this.playerDescription;
                  }

                  //Assign playerDescription to txtDescription
                  btnPlayer.onRollOver = function() {
                  displayDescription();
                  this.mcDescription.txtDescription.htmlText = my_lv.playerDescription;
                  }


                  The text file I am referencing contains the following:

                  playerDescription=<ul><lh>Player Membership</lh><li>Player Locator</li><li>Ride Board</li><li>Roomates</li><li>PGN Access</li><li>Tournament Discounts</li></ul>&organizerDescription=<ul><lh>Organizer Membership</lh><li>DIY Tournament Postings</li><li>Club Event Postings</li><li>Online Checkout</li><li>Peer Promo Network</li><li>Advertising Discounts</li></ul>&merchantDescription=<ul><lh>Merchant Membership</lh><li>Marketplace</li><li>Advertising Discounts</li></ul>&teacherDescription=<ul><lh>Teacher Membership</lh><li>Class Postings</li><li>Online Checkout</li><li>Peer Promo Network</li><li>Advertising Discounts</li></ul>&sponsor Description=<ul><lh>Sponsor Membership</lh></ul>

                  I've been trying hard to get this working, but to no avail.
                  • 6. Re: Load External Text into Flash MX
                    proPingu Level 1
                    // create new LoadVars instance //

                    loadVariablesNum("descriptions.txt", 2);
                    function displayDescription() {
                    if (_level2.done == undefined) {
                    trace("not yet.");
                    } else {
                    trace("finished loading. killing interval.");
                    trace("-------------");
                    }
                    }

                    // Assign playerDescription to txtDescription //

                    btnPlayer.onRollOver = function() {
                    displayDescription();
                    this.txtDescription.htmlText = _level2.playerDescription;
                    };

                    // The text file as u referencing contains the following. I add here done var for checking :

                    playerDescription=<ul><lh>Player Membership</lh><li>Player Locator</li><li>Ride Board</li><li>Roomates</li><li>PGN Access</li><li>Tournament Discounts</li></ul>&organizerDescription=<ul><lh>Organizer Membership</lh><li>DIY Tournament Postings</li><li>Club Event Postings</li><li>Online Checkout</li><li>Peer Promo Network</li><li>Advertising Discounts</li></ul>&merchantDescription=<ul><lh>Merchant Membership</lh><li>Marketplace</li><li>Advertising Discounts</li></ul>&teacherDescription=<ul><lh>Teacher Membership</lh><li>Class Postings</li><li>Online Checkout</li><li>Peer Promo Network</li><li>Advertising Discounts</li></ul>&sponsor Description=<ul><lh>Sponsor Membership</lh></ul>&done="done"

                    it's working