Skip to main content
Known Participant
February 22, 2011
Question

Buritto/Hero4.5 html images in TextArea

  • February 22, 2011
  • 2 replies
  • 689 views

Well I've been using a Spark TextArea in a Spark VGroup and loading dynamically from an XML file HTML.

I even managed to make anchors send events that are listened too! Awesome.

after using a MobileTextField for CSS and my code for extracting from XML

The XML needs to have the entries wrapped in CDATA for those interested.

[note: viewText is just a String.]

            var mtf:MobileTextField;
             if(targetTextArea != null) {
                 mtf = targetTextArea.textDisplay as MobileTextField;
             }

              ...

            mtf.htmlText = viewText;

            mtf.addEventListener(TextEvent.LINK, linkHandler);
        }
       
        public function linkHandler(linkEvent:TextEvent):void {

        }

Anyway IMG SRC tags don't seem to be working however I reference them. Assets ../Assets jpg png whatever, yet it's suggested somewhere that's suppose to work. I've seen it explained you can use getImageReference via an id attribute to get to the image it's self and that a loader is automatically created for you, so I'm thinking that it is broken when you load from XML or something but I'm basically stuck without it working so any help or verification of it being a bug or not would be greatly appreciated.

This topic has been closed for replies.

2 replies

as4moreAuthor
Known Participant
February 22, 2011

Trying TextFlow directly which would override the stuff in the MobileTextField about css...

        import spark.utils.TextFlowUtil;

            targetTextArea.textFlow = TextFlowUtil.importFromString(viewText);

Unknown Element B?

I changed to Span weight bold or delete for image testing and it's not a solution in this case although it is demonstrated here...

http://polygeek.com/flex/2249_displayHTMLText_SparkTextArea/srcview/index.html

I'm totally lost here?!! It should just work and doesn't can someone at Adone please make a note to fix this...

Putting an <IMG SRC="whatever.jpg"/> tag as a spark TextArea's htmlText should simple work, and it doesn't end of story.

Still if there's a way or a work around until than I'd like to know about it.

My final thought is considering this is meant for a MobileApplication's "help" section to tell what icons are (without rollovers and all in TouchScreen land), it's I suppose going to ned to work before deployment can proceed.

as4moreAuthor
Known Participant
February 22, 2011

Well just tried hard coding a working full URL into MXML and that doesn't work either?!?

        <s:VGroup id="scrollGroup" x="13" y="112" width="446" height="567" paddingLeft="2">
            <s:TextArea id="contentTextArea" width="442" height="565" fontFamily="Verdana" fontSize="18" text="Loading..." textAlign="justify" selectable="false">
                <s:content>
                    <s:img source="http://www.ct4me.net/images/Showing_Grade_1.jpg"/>
                </s:content>
            </s:TextArea>
        </s:VGroup>

[Not my image jsut a random tester]

I've also noted an example where in the <IMG tag SOURCE= is used instead of SRC=

but so far that doesn't seem to make a difference, either ;-(

This problem must have something to do with MobileApplication or MobileTextField? I've added that so that Styles could be introduced I think?