8 Replies Latest reply on Jan 7, 2009 6:30 PM by mikeyjray

    Load dynamic text into an embeded swf

    mikeyjray Level 1
      I have my main stage, and into this main stage I am embedding another .swf file (multiple instances on a map). I would like to be able to load dynamic text from an array on the main stage into the embedded .swf - can this be done?

      Here is what I have tried, and failed with:
      1) Creating a dynamic text box on the embedded .swf, giving it an instance name of load_txt, and writing AS in that .swf for load_txt.text = array ;
      2) Creating a dynamic text box on the embedded .swf, giving it an instance name of load_txt, creating a variable on the main stage of var embed = {url:'embed.swf'};, and writing AS in the main stage for marks.load_txt.text = array
      .

      Below is the function that places the embedded .swf files onto the map, from the list of locations stored in "array":
        • 1. Re: Load dynamic text into an embeded swf
          Ned Murphy Adobe Community Professional & MVP
          For the first case you described, you could try...

          load_txt.text = _root.array ;

          assuming array holds the text you intend to write into that textfield.
          • 2. Re: Load dynamic text into an embeded swf
            mikeyjray Level 1
            Yah, I tried that and no luck - I keep getting an "undefined" in the load_txt text box.

            Below is some more of the code that I'm using to store the addresses into the array, and as you can see in the addMarkers function, I'm running a trace on addressA which DOES work (it shows the individual address in the trace - which is what I want loaded into the text boxes of the embedded swf file).

            I'm stumped! I would think that if it can trace EXACTLY what I want it to trace it should be able to load it into the embedded swf...or maybe I keep getting "undefined" as my return result in embed.swf because I'm trying to load the addressA
            outside the addMarkers or parseXML function.

            Ideas?
            • 3. Load dynamic text into an embeded swf
              mikeyjray Level 1
              I just tried putting the following AS into the embed.swf file, and when I SPECIFY which part of the array I get that to show, but that value shows for every instance of the embed.swf load_txt box.

              load_txt.text = _root.addressA[0];

              or

              load_txt.text = _root.addressA[1];

              From this logic it doesn't make sense for it to not load it in a variable instance of markeraddy_txt.text = _root.addressA ; when it embed.swf is called for to create an instance of it (at the request of addressA).

              I might go crazy with this! Sometimes I just try to work way beyond what I'm capable of!
              • 4. Load dynamic text into an embeded swf
                mikeyjray Level 1
                I just tried

                myMap.load_txt.text = addressA ;

                where "myMap" is the instance name of the map where I am overlaying/inserting the embedded swf file, but that too did not work.

                Darn this yahoo! map - I thought it would be easier to use!

                Any ideas?

                Again, it does trace the addresses properly and does show a specific address from array if I tell it to (load_txt.text = _root.addressA[0];) but will not work if I try to run it as an increasing variable...which is what I want because I don't want to have EVERY instance of the embedded swf to have the same address
                Text
                • 5. Re: Load dynamic text into an embeded swf
                  Ned Murphy Adobe Community Professional & MVP
                  I guess I'm not clear on the scenario overall.

                  Are there swf's embedded within myMap that contain the textfields (one each) that you are trying to fill? If so, what code do you use to load those swf's?
                  • 6. Re: Load dynamic text into an embeded swf
                    mikeyjray Level 1
                    Hi Ned,

                    What I'm doing is using a yahoo map to load addresses and place custom swf files as the placemarkers. The main stage has an instance of myMap, which is the map that yahoo sets us to display the ACTUAL map. They have also provided coding for placing markers on the map, which is what I'm using.

                    I have the addresses throughout multiple xml files, which I am actually loading through 1 single xml file. These addresses are being stored in an array, then called by the AS below to place markers. All the markers are placed correctly, however, I am trying to have them actually say the address - this is where the problem lies.

                    The marker that is being located and placed has a text field called load_text in it. I want that field to load the same address that is being used to place it (from the array addressA).

                    I'm very confused because every loop through the * for (i=0; i<addressA.length; i++) * loop the marker is placed at the correct addressA location, but I cannot actually get the address to load into the load_txt field in the marker. I can even run a trace during that loop and it traces addressA for each address, but I can't seem to actually load those values into the load_txt box.

                    Do you have any ideas?
                    • 7. Re: Load dynamic text into an embeded swf
                      Ned Murphy Adobe Community Professional & MVP
                      I'm looking for a handle on the embedded swf's. If those are what hold the textfields, then those are what need to be targeted. That's why I'm wondering about how (the code) these embedded swf's get loaded in. I can see some function being called that probably does this (addMarkerByAddress), but I can't see the function itself. Somewhere in that function there oughta be something that provides some form identifier that can be used to target them.
                      • 8. Load dynamic text into an embeded swf
                        mikeyjray Level 1
                        Hmm...I see what you're saying. I don't know if this helps, but this is the link to the Yahoo! Maps Web Services - Flash® APIs Reference Manual Link.

                        I'll keep searching online to see if there is anything else that might be useful!

                        EDIT: I just found this page, and I've got it! Finally! Thanks for all the help guys/girls - I wouldn't have been able to get this far without you!! Link