Actionscript :: Strip (HTML) Tags From A String In Flex 4.5 / 4.6?
Nov 20, 2011How do you strip (HTML) tags from a String in Flex 4.5 / 4.6?
View 1 RepliesHow do you strip (HTML) tags from a String in Flex 4.5 / 4.6?
View 1 RepliesI have a string variable assigned with some Content in HTML format.[code]...
But in the output i am getting as This is <b. Basically it considering HTML related tags also as text. But my code has to omit the HTML tags while calculating sub string.
to restrict the maximum number of characters on a TextField by applying the maxChars to 30. This call exists before applying the html text to the TextField. For some reason nothing happens.textfield.maxChars = 30;var str:String = "<p><h3>Quisque id velit risus, vitae dictum sapien.</h3><p>Fusce aliquam nunc id risus lobortis in malesuada mi pellentesque. Suspendisse potenti.</p><br/><justify>Nulla facilisi. Maecenas bibendum tortor ac felis tristique eget suscipit enim dapibus. Curabitur ut eleifend purus. Sed elementum facilisis dui in dapibus.</justify></p>";textfield.htmlText = str;
View 3 RepliesI am designing a web application in Flex 4 and currently facing an issue rendering advanced HTML tags and entities in Flex 4. All I want to do is basically render an HTML text coming to me something like the one given below:-
[Code]....
I want to alter the text color inside a string that has some HTML tags using regular expressions.My question is how can I alter the letters only of the text between html tags and not inside the html tagsI am using something like this:
ActionScript Code:
var exp:RegExp = new RegExp(textfield.text,"i")
str = str.replace(exp, "<font color='#FF0000'>$&</font>");
[code].......
I'm using a custom tooltip in order to be able to use html tags. The method I used is described here.I'm using SDK v.3.5. I also did a little hack so that the TooltipManager.tooltipClass would work (check this post for more details).Here's some code.
HtmlTooltip.as:
public class HtmlTooltip extends ToolTip
{[code].....
Everything works fine BUT 2 things: First, font colors tags don't work. If ever I use sth like <font color='0xadadad'>...</font> it won't work. However, if I use <u>...</u>, it works fine
Second, the <a href='...'>...</a> does not work either. I checked in several websites, and the solution would be to set the selectable property of the text to true.
I need to remove some redundant ' 's from the end of a csv I'm importing before it divides the lines up into an array (otherwise I get extra empty rows).
[Code]...
I have HTML file, I changed its extension to .XML.I'd like to convert HTML tags to valid XML document using AS3.
View 6 RepliesHow to place two different texts (using html tags) in column in a datagrid, in which one will be right aligned and the other will be left aligned.
View 2 RepliesI'm writing a HTML parser in Flex (AS3) and I need to remove some HTML tags that are not needed.
For example, I want to remove the divs from this code:
<div>
<div>
[code].......
I wrote a function to override y FLEX LineChart's datatips because the default datatips were ugly and rather boring.I finally set the style I wanted but am now having some problems removing un-necessary tags from being displayed in the custom datatips.For example, the datatips now display things like this:
"<b>Humidity</b></BR>2010-07-05T00:15:00"
I can always perform a "Replace()" to remove those break and bold HTML tags, but that seems really un-necessary and anti-development.I am using this to set the dataTip's label text:
var hd:HitData = value as HitData;
var item:LineSeriesItem = hd.chartItem as LineSeriesItem;
_xAxisText = String(hd.displayText + ' ' + item.xValue);
[code].....
I have a scenario that I get an string with html data, this is not just html data it's an email (outlook) saved as an html file and dropped in the string.Now this string needs to be formatted to an html document and should be a clickable link in a datagrid. So when I click on the link, the HTML document should pop-up and should gave me a nice HTML page that is readable for the normal users. I hope it's a bit clear what I want o_0. don't know where to start.
View 3 Repliestrying to work with "simple" XML for the first time. I'm building a small CMS for a Flash based site and the content is held in an XML file. My problem is that many of the copy fields are XML CDATA fields. on the one hand, with:
$xml = simplexml_load_file($file, 'SimpleXMLElement', LIBXML_NOCDATA);
I can pull the data out of that node and the CDATA tags are stripped. My issues come with trying to save the data with:
file_put_contents($file, $xml->asXML());
Problems are: a) tags are interpreted with their HTML entity equivalents. I don't want this to happen.I gather this is coming from the asXML method because even if I do anhtml_entity _decode on the $_POST data it's still being converted.
b) because of the above, there's no way to add the CDATA tags because they also have their charachters converted.
I am looking for a very basic html editor (similar to the one being used in this forum to make entries - only more basic)...which ONLY uses html tags supported by the AS2 textfield....
View 1 RepliesI was wondering if flash can load html document, the way browser displays it.
View 1 RepliesI have a string that looks like this:
"assets/images/1.jpg;assets/images/2.jpg;assets/images/3.jpg";
how can i create an array that pushes each link in it and removes the ;?
something like this:
var images:Array = {assets/images/1.jpg,assets/images/2.jpg,assets/images/3.jpg};
I'm trying to target a specific tag and its children with a function I have.I have two functions written basically the same, except one is trying to reference a target. For some reason on the one trying to reference a target, I get the XML tag names still attached to the URL. Does anyone know why this would happen in one function and not the other?Working function:
Code:
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
[code].....
I wanted an animation to dispatch custom events as it cycled. It became apparent that not even trace() was running. After some searching, I found the following at Adobe:[URL].."If the SWF file contains any ActionScript code, Flex prints a warning during compilation and then strips out the ActionScript from the embed symbol. This means that you can only embed the symbol itself."
I also found a work-around by Grant Skinner at:[URL].. I can proceed, but I'm still wondering. Why does mxmlc strip ActionScript from Flash compiled resources when embedding their symbols into Flex apps using metatags?
how can I strip trace() messages from a flex and flash applications? I write flash and flex applications and i use a lot of trace messages for debugging, but when i product the actual swf i want it to be stripped from any trace messages.
View 6 RepliesI'm working on a textField overflow system for a project at the moment.I cant find a way to return a textField's htmlText complete with the original html tags.The system is used for splitting up a textField above a particular height into two textFields so the side of each other. The system works perfectly with unformatted text, but I cant seem to extract the formatting tags out of the left textField and apply them to the right - all I can get is plain text. (The system uses a StyleSheet by the way - so it is applied to both textFields).I 've tried:
Code:
if (leftField.textHeight > contentHeight) {
//var rightString:String = new String;
var lastLineIndex:int = leftField.getLineIndexAtPoint(10, contentHeight - 5);[code]...........
The commented out code represents the alternative method I've tried (still fails).
Trying to bring in an xml document that contains HTML tags but I can't seem to get it working.
I have a bit of AS and a basic text field in a movie clip for now. I've pared it down as simply as I can to the following AS:
[Code].....
I have an XML document that contains CDATA nodes with <BR> tags. I'm importing the XML and displaying it in a text box, but unfortunately the text box is actually displaying the <BR> tags, rather than inserting line breaks. I've set the text box to "Render text as HTML", and I've applied the XML data through htmlText, but it's still not working. If I insert text into the text box manually it will render as HTML, as in:
Code:
textBox.htmlText = "Testing...<br>Testing...";
But if I apply the XML node, it just displays the <BR> tags, like this:
Code:
textBox.htmlText = my_xml.firstChild.childNodes;
I've included a .zip attachment that contains a sample .xml and .fla file that illustrates the issue I'm having.
This is a typewriter effect but i need the XML to also read and render HTML. right now it just types out normal text and if you insert HTML it types out the HTML instead of actually rendering it.I need to insert a small image after every item in the XML.
Code:
package com.dhmpire {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Stage;
[code]....
i am loading all my text content from an external XML file....now i want to use html tags in that file (XML)....
View 4 RepliesCode:
TextField.appendText()
instead of
Code:
TextField.htmlText+=..
but I can't get it working when I use html tags in my strings. For instance:
Code:
tField.htmlText +="<TEXTFORMAT LEFTMARGIN='14' LEADING='3'><FONT FACE='MetaPlusBold-Roman' SIZE='12.5' COLOR='#D9098C'>" +xml.*.@*[i].toString()+"<BR>"+ "</FONT></TEXTFORMAT>";
doesn't show the text.
in the attachment, you'll see the text display is quite awful despite the fact I embed Arial font in my application.
View 2 RepliesI have several paragraphs of text that is using the scrollBar component to give me some scrollability that part works fine. I also have the "render text as html" box checked because I have some HTML formatting going on. Anyway, all of a sudden the published SWF file started ignoring the bold tags <b>. It used to work fine. Now, anywhere that I have text surrounded by <b> HTML tags, it just omits that portion of my copy once the file is published. When I change the tags to <strong>, the text comes back, but in a normal font both with the fonts embedded and without ... neither makes a difference with this issue. I've also tried checking and unchecking the "render text as html" box and that doesn't seem to make a difference. Has this bold tag become deprecated? I'm having difficulty get a font to display as bold.
[Code]...
For example there are some html tags
<div id="test"><div><div>testtest</div></div></div></div></div></div>
From that html, I need to get this
<div id="test"><div><div>testtest</div></div></div>
Current regex /<div id="test">.*(</div>){3}/gim
"I have a site I made that I am streaming video on, its starting to look pretty cool but
the menu I made in CSS is always under the video so some of the links dissappear behind the object, does anyone know if I can fix this, I think I tried z-index one time to no avail?
Is there a way to read html tags from xml files as a text and then display them in a text box with htmlText?
I know one way of doing that is replacing anyother letter instead of "<" or ">", but the client will directly replace html text in the xml file