[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

special characters -  html to flash

Posted on 2010-09-23
2
Medium Priority
?
591 Views
Last Modified: 2013-11-11
I need flash to display special characters originating from an xml file.

I have written a test app and put it into the code section.

In that code I am replacing the ® with \u00AE, but it only works for the String variable not the XML variable.

I need answer to one of two questions.

1) Is there a way to get flash to recognize the html special character and convert it to unicode.

2) Code to convert   ® to \u00AE in the xml variable.

Thank you


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	
	<fx:Script>
		<![CDATA[
			private var myRecords:XML =
				<records>
					<record>
					<crop>Carrot</crop>
					<product>Bravo 500 &reg;</product>
					<pestType>disease</pestType>

					</record>

					<record>
					<crop>Carrot</crop>
					<product>Dithane  F-45 &reg;</product>
					<pestType>disease</pestType>
					</record>
				</records>
			
			private var myPattern:RegExp=/&reg;/g;
			private var myString:String = "<product>Bravo 500 &reg;</product>";
			
			protected function myButton_clickHandler(event:MouseEvent):void
			{
				lbl_test.text=myRecords;
				lbl_test2.text = myRecords.replace(myPattern,"\u00AE");
				lbl_test3.text = myString.replace(myPattern,"\u00AE");
			}
			
		]]>
	</fx:Script>
	
	<s:Label id="lbl_test" x="73" y="139"   width="183" fontSize="16"/>
	<s:Label id="lbl_test2" x="278" y="139"   width="176" fontSize="16"/>
	<s:Label  id="lbl_test3" x="478" y="138"   width="166" fontSize="16"/>
	
	<s:Button id="myButton" click="myButton_clickHandler(event)" x="307" y="74" label="Click Here"/>
	
</s:Application>

Open in new window

0
Comment
Question by:darmcqueen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33751950
0
 
LVL 8

Accepted Solution

by:
ActionScript_Helper earned 2000 total points
ID: 33759569
As you said string is working so, you can try converting XML to String and than string to XML:

===========

lbl_test2.text = myRecords.toString().replace(myPattern,"\u00AE");

// string to XML
myRecords = new XML(myRecords.toString().replace(myPattern,"\u00AE"));
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question