10 Replies Latest reply on Oct 22, 2010 8:30 AM by kglad

    How to format XML text

    juresti Level 1

      I'm using CS4 AS2. Should I just use CDATA tag within the XML is this the easiest way? I have 32 swfs which are each loaded to a holder at different times. Do I use code to format the text? The boxes exist in the swfs already. Any help is appreciated.

        • 1. Re: How to format XML text
          kglad Adobe Community Professional & MVP

          a cdata tag is needed if you have content you don't want parsed by the xml parser.  most commonly that would include any content that contained an angle bracket:  <  or >

           

          but can include other situations.

          1 person found this helpful
          • 2. Re: How to format XML text
            juresti Level 1

            I decide to use the following code:

             

            var myFormat = new TextFormat ();
            myFormat.font = "Arial";
            myFormat.size = 12;
            myFormat.color = 0x006699;

             

            toolName_txt0.setTextFormat (myFormat);

             

             

            I have 32 swfs each have 5 frames, they load into a movieHolder clip in the Movie Holder movie. The code works but it has to be input on each button release when the movie moves to each frame and then the code will be input on each of the 32 swfs.

             

            I was just wondering if there was a way to set all the code in one spot or one swf. Any idea help is appreciated!!

            • 3. Re: How to format XML text
              kglad Adobe Community Professional & MVP

              yes, code can always be maintained in one location.  but how you do that depends on your setup and i don't understand your setup.

              • 4. Re: How to format XML text
                juresti Level 1

                My setup is 32 questions (swfs) consisting of 5 frames. Each frame is basically the same. The first asks the user to pick the one  item out of 4. When the user selects and item he goes to a frame 2, 3, 4 or 5. These frames tell user if he is correct or incorrect and provide a description to him of the item he chose. Each frame has dynamic text boxes where the text is pulled in from an XML file.

                 

                There are 32 swfs each subsequent one loaded once the user selects the correct item. There is a MovieHolder.fla and within the clip movieHolder these 32 are loaded using loadmovie.

                 

                I don't know if that makes sense to you but that's about how it is working. I am ok with inputting the textformat code in each swf if I have to.

                 

                HAve a great day.

                • 5. Re: How to format XML text
                  kglad Adobe Community Professional & MVP

                  your main swf could contain the code for all 32 load targets.  if you xml files aren't conveniently named, you will need to use an array to associate the loaded swf with the corresponding xml file.

                  • 6. Re: How to format XML text
                    juresti Level 1

                    I'm going to look into this. Thank u!

                    • 7. Re: How to format XML text
                      kglad Adobe Community Professional & MVP

                      you're welcome.

                      • 8. Re: How to format XML text
                        juresti Level 1

                        I put the formatting code in the main movie which contains the swfs. Each swf loads the other, the main movie loads the first swf. I could not target the loaded swfs from the main movie, they are all loaded in the MC  "movieHolder" so one swf loads each subsequent one. The first two swfs do not have dynamic text boxes which I need to format, the rest do.

                         

                        I tried the basic:

                         

                        movieHolder.question_txt.setNewTextFormat (mainTitle);

                         

                        the bold is the movieclip. mainTitle is the text format variable. Does flash need to know when theparticular swf movies load? Also how can you target frames within those swfs. Sorry so many questions.

                         

                        This code works if it is placed in each swf:

                         

                        question_txt.setNewTextFormat (_parent.mainTitle);
                        qDetails_txt.setNewTextFormat (_parent.bodytext);

                         

                        I wanted to know if I could just use the formatting code once in the main movie. Any help is appreciated.

                        • 9. Re: How to format XML text
                          kglad Adobe Community Professional & MVP

                          the main swf should load all the other swfs if you want to centralize your code.

                          • 10. Re: How to format XML text
                            juresti Level 1

                            I see what you mean. Unfortunately it was not originally set up that way. Hmm I will have to just add the code to each swf or try and centralize the code. Ok thanks!