开发者

Special Characters in flex from HTML Params

I am accessing some params from HTML to flex, those are special characters(html codes).

Below is the Sample Code:

HTML Param:

flashvars.sampleText = "スー谷スー谷スー谷&a开发者_如何学Cmp;#12473;ー谷"

Flex Code:

<?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[
            import mx.core.FlexGlobals;
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>




    <s:Panel>   
<s:Label text="{FlexGlobals.topLevelApplication.parameters.sampleText}" />
</s:Panel>
</s:Application>

When i am checking the above sample code in IE Browser its working fine, But its not working in Mozilla and Chrome browsers.

What could be the Problem ? How can i able to display this in other browsers? Can anyone help on this?

Thanks in Advance

Rajesh


Have you tried url encoding your String in Javascript then decodinf in AS?

For e.g.: Javascript:

flashvars.sampleText = escape("String with special characters");

AS/MXML:

<s:Label text="{unescape(FlexGlobals.topLevelApplication.parameters.sampleText)}" />

Hope it helps, Rob

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜