Hi,

This is a  snippet I use for rendering HTML text with basic CSS in a spark
textarea.
Can't remember where I found this but it does exactly what I need.

 var styles:String = "a { color: #DE000F; text-decoration: underline; }";
var myStyleSheet:StyleSheet = new StyleSheet();
myStyleSheet.parseCSS(styles); var descriptionStf:StyleableTextField =
descriptionTxt.textDisplay as StyleableTextField; var format:TextFormat =
descriptionStf.defaultTextFormat; format.bullet = null;
descriptionStf.defaultTextFormat = format; descriptionStf.htmlText =
someHTMLText; descriptionStf.width = 300;
//FlexGlobals.topLevelApplication.width;descriptionTxt.skin.invalidateSize();
callLater(
function():void{ StyleableTextField(descriptionStf).styleSheet =
myStyleSheet; }); } <s:TextArea id="descriptionTxt" skinClass=
"spark.skins.mobile.TextAreaSkin" width="100%"
whiteSpaceCollapse="collapse"editable=
"false" borderVisible="false" selectable="false" paddingLeft="0"paddingRight=
"0" paddingTop="20" paddingBottom="40"
contentBackgroundColor="0xffffff"contentBackgroundAlpha=
"0" cacheAsBitmap="true"/>


On Thu, Apr 3, 2014 at 10:38 PM, Scott Matheson <[email protected]>wrote:

> thanks, that interesting  and works give me a direction, unfortunialty not
> what i want to achieve
>
> maybe i am starting from the wrong place, i want text that the student can
> click, on, each click plays a voice recording
>
> i achieve this by add each sentence s a
>
>
>
>
> ________________________________________
> From: [email protected] [[email protected]] on behalf of OmPrakash
> Muppirala [[email protected]]
> Sent: Thursday, April 03, 2014 9:23 PM
> To: [email protected]
> Subject: Re: <BR> in TextArea
>
> That's interesting.  Here is how I tested this hack and and does seem to
> work for me:
>
> Using this textflow xml:
>
> <?xml version="1.0" encoding="utf-8"?>
> <flow:TextFlow whiteSpaceCollapse="preserve" xmlns:flow="
> http://ns.adobe.com/textLayout/2008
>
> "><flow:p><flow:span>sentence1&#13;</flow:span></flow:p><flow:p><flow:span></flow:span></flow:p><flow:p><flow:span>sentence2&#13;</flow:span></flow:p><flow:p><flow:span></flow:span></flow:p><flow:p><flow:span>sentence3&#13;</flow:span></flow:p><flow:p><flow:span></flow:span></flow:p></flow:TextFlow>
>
> In the online TLF editor here [1], click on the 'Markup...' button.  In the
> panel that shows up, copy and paste the above textflow xml.  Then click
> 'Import'.  The end result seems to be what you wanted.
>
> You may have to adapt this to your use workflow somehow.
>
> Thanks,
> Om
>
> [1] http://www.adobe.com/devnet-apps/tlf/demo/
>
>
> On Thu, Apr 3, 2014 at 1:10 PM, Scott Matheson <[email protected]
> >wrote:
>
> > Om
> >     I am an old fashioned hacker, :)  so did i undeeratsnd you
> suggestion?
> > i tried this with out any lic
> >
> > var linkWrapper:LinkElement = new LinkElement();
> > linkWrapper.addEventListener(FlowElementMouseEvent.MOUSE_UP,
> > clickActionHandle(model.clip));
> > var sentence:SpanElement = new SpanElement();
> >
> > var ss:String = " Lorem ... diam.&#13; Morbi ... diam.&#13; Morbi ...
> > vitae";
> >
> > sentence.text = ss;
> >
> >
> > linkWrapper.addChild(sentence);
> > paragraphArea.addChild(linkWrapper);
> >
> >
> > i just end up with the .&#13  in the textArea
> >
> > <s:TextArea id="ta" minHeight="0"  width="100%" editable="false"  >
> >                         <s:p id="paragraphArea" paragraphSpaceBefore="0">
> >                         </s:p>
> > </s:TextArea>
> >
> >
> >
> >
> > ________________________________________
> > From: [email protected] [[email protected]] on behalf of OmPrakash
> > Muppirala [[email protected]]
> > Sent: Thursday, April 03, 2014 6:51 AM
> > To: [email protected]
> > Subject: Re: <BR> in TextArea
> >
> > According to the docs [1] the breakelement gets converted into newline
> > character and hence does not appear in TextFlow markup.
> >
> > As a hack, you can try inserting &#13; where you want a <br>
> > Again, if you export the markup, the &#13; will get replaced by a newline
> > character.  But at least your display would look like how you want.
> >
> > Thanks,
> > Om
> >
> > [1] http://blogs.adobe.com/tlf/category/tlf
> >
> > On Wed, Apr 2, 2014 at 1:50 PM, Scott Matheson <[email protected]
> > >wrote:
> >
> > > Hi
> > >    I am trying to build a Paragraph from sentences,
> > >
> > > this builds the Paragraph (from am XML file and itemRender)
> > >
> > > the build function looks like
> > >
> > >
> > > var linkWrapper:LinkElement = new LinkElement();
> > >
> > > var sentence:SpanElement = new SpanElement();
> > >
> > > sentence.styleName = 'linkStyle';
> > >
> > > sentence.textDecoration = TextDecoration.NONE;
> > >
> > > sentence.text = model.text + " ";
> > >
> > > linkWrapper.addChild(sentence);
> > >
> > > paragraphArea.addChild(linkWrapper);
> > >
> > >
> > >
> > > Layout
> > >
> > >
> > >
> > > <s:TextArea id="ta" minHeight="0"  width="100%" editable="false"
> > >
> > > <s:p id="paragraphArea" paragraphSpaceBefore="0">
> > >
> > > </s:p>
> > >
> > > </s:TextArea>
> > >
> > >
> > >
> > > I get
> > >
> > >
> > > sentence1
> > >
> > > sentence2
> > >
> > > sentence3
> > >
> > >
> > >
> > > my problem is how to i add a <br> in to the Paragraph and end up with
> > >
> > >
> > > sentence1
> > >
> > >
> > > sentence2
> > >
> > >
> > > sentence3
> > >
> > >
> > >
> > > it would be good if the  input text  model.text  could be
> > > "sentence1<br>sentence2<br>sentence3"
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > >
> > > Disclaimer: This electronic mail and any attachments are confidential
> and
> > > may be privileged. If you are not the intended recipient, please notify
> > the
> > > sender immediately by replying to this email, and destroy all copies of
> > > this email and any attachments. Thank you.
> > >
> >
> > ________________________________
> >
> > Disclaimer: This electronic mail and any attachments are confidential and
> > may be privileged. If you are not the intended recipient, please notify
> the
> > sender immediately by replying to this email, and destroy all copies of
> > this email and any attachments. Thank you.
> >
>
> ________________________________
>
> Disclaimer: This electronic mail and any attachments are confidential and
> may be privileged. If you are not the intended recipient, please notify the
> sender immediately by replying to this email, and destroy all copies of
> this email and any attachments. Thank you.
>

Reply via email to