8 Replies Latest reply on Nov 3, 2009 3:55 AM by leoserra

    Euro Symbol from Dynamic Text

    BrianStapleton

      Sorry, me again! I understand that this seems to be a pretty common problem. My euro symbol isn't showing up in the XML text I bring into Flash. I've worked with our developer to replace the euro symbol with "EURO" in the XML so that at least it shows up in Flash and I'm trying to use actionscript to change it back to the euro symbol. I found some script here (see the 2nd post) and I thought it looked promising but it's not working for me. Have I adapted it correctly?

       

      function replaceSpecChars(txtField):Void {
          for (var i = 0; i < txtField.text.length; i++) {
              var euro:String = "EURO";
              var euroPos:Number = txtField.text.indexOf(euro);
              if (euroPos > -1) {
                  txtField.replaceText(euroPos, euroPos+3, "€");
              }
          }
      }


      replaceSpecChars(newsContent.articleHeadline.text);

        • 1. Re: Euro Symbol from Dynamic Text
          Rothrock Level 5

          I don't think you need to use special XML replacements or special code. Flash really likes unicode so if your XML files are saved/create as UTF-8 that will go a long way toward helping. I made a small file called euro.xml that contained the following:

           

          <price>

          <![CDATA[€129,00]]>

          </price>

           

          Hope the forums don't mangle that.

           

          Then I create a fla and put a dynamic text box on the stage called value. Don't forget to embed the font. In my case I did Basic Latin and then in the "Include these characters" field I added the euro sign. Then I used this code:

           

          var home:MovieClip=this;

           

          var xml:XML=new XML();

          xml.ignoreWhite=true;

           

          xml.onLoad=function(success){

          home.value.text=this.firstChild.firstChild.nodeValue;

          }

           

          xml.load("euro.xml");

           

          And, hey Bobs your uncle. It shows just fine.

          1 person found this helpful
          • 2. Re: Euro Symbol from Dynamic Text
            Rothrock Level 5

            PS: You have to be sure that the font you are using has a Euro symbol. A few oldies don't but in this day and age most respectable fonts should have it.

            • 3. Re: Euro Symbol from Dynamic Text
              BrianStapleton Level 1

              Thanks again Rothrock! I'm working with our web developer on this at the moment so hopefully we can get it sorted. We've been following your directions but haven't got it working yet. And now I've noticed that all quotation marks and apostrophes are missing in flash when I export the movie!

              • 4. Re: Euro Symbol from Dynamic Text
                Rothrock Level 5

                Not sure what that is about. I'm wondering if they are "curly/smart quotes"? Those aren't included in the Basic Latin embedding. If they are then you'll need to need to add them to the additional characters box or make the original source file just have straight/dumb quotes.

                 

                How are you creating the XML files?

                • 5. Re: Euro Symbol from Dynamic Text
                  leoserra Level 2

                  Hi Brian,

                   

                  Maybe is a bit late for an answer, but I stumble upon the same problem, but worked it out in a different way, that I hope it will you and others about this issue.

                   

                  I wanted also to display the euro sign, but thw symbol is not beeing recognized by Flash although the font that I use, has the symbol.

                   

                  So I did the following:

                  - In the XML, replace the euro sign by a keyword, lets say: "eurosign";

                  - Possibly you will display the value in your SWF file, from a String variable. In this case, you have to detect the keyword and replace it by the character "€" itself, like this:

                  myString = myString.split("eurosign").join("€");

                   

                  This did the trick for me.

                  • 6. Re: Euro Symbol from Dynamic Text
                    leoserra Level 2

                    Hi Brian,

                     

                    Maybe this is a bit late, but I stumble in the same question and droped here, in your question, trying to get some clues. Hope my solution will help you or others with the same issue. It's not the ideal, but it's simple.

                     

                    I stumbled upon the same question as you did, although I used a font that had the "€". Tried every possible code in the XML file, but nothing.

                     

                    So I did one other thing. The values that I want to display are stored in a String variable, so there's a simple method of placing the euro sign where you want.

                     

                    I did the following:

                    - In the XML file I replaced the euro sign by a keyword. Lets say: "eurosign";

                    - Then in the actionscript, I detect where "eurosign" is and replaced it with the "€" like this:

                    myPrice = myPrice.split("euros").join("€");

                     

                    This did the trick for me.

                     

                    Hope it helps

                    • 7. Re: Euro Symbol from Dynamic Text
                      leoserra Level 2

                      Hi Brian,

                       

                      Maybe this is a bit late, but I stumble in the same question and droped here, in your question, trying to get some clues. Hope my solution will help you or others with the same issue. It's not the ideal, but it's simple.

                       

                      I stumbled upon the same question as you did, although I used a font that had the "€". Tried every possible code in the XML file, but nothing.

                       

                      So I did one other thing. The values that I want to display are stored in a String variable, so there's a simple method of placing the euro sign where you want.

                       

                      I did the following:

                      - In the XML file I replaced the euro sign by a keyword. Lets say: "eurosign";

                      - Then in the actionscript, I detect where "eurosign" is and replaced it with the "€" like this:

                      myPrice = myPrice.split("euros").join("€");

                       

                      This did the trick for me.

                       

                      Hope it helps

                       

                      Message was edited by: leoserra - Sorry about the double entry, the first one returned error, but was saved :S

                      • 8. Re: Euro Symbol from Dynamic Text
                        leoserra Level 2

                        Another solution that I just found out, even simpler... well it worked

                         

                        In the XML replace the "€" with this code &#x20AC;