Loaded HTML Text In Flash not displaying with BlendMode.LAYER - html

Have a textField in which I'm loading HTML formated text into it. This textField sits inside a parent container which has its blendMode property set to BlendMode.LAYER. When I run the movie, the html text doesn't display. Any clues why?

textField.embedFont = true;
textField.defaultformat = new Format("EmbedFontName");
Do you have something like this?
or embed font characters?

If it doesn't work with normal blend mode either:
Does the loaded html contain unsupported html tags? Flash text fields support only a limited subset of html tags.
If not, it could be embedded fonts issue as konrad suggested.

Related

how do I make angular-sanitize not remove iframe tags from html

I am using textangular which uses angular-sanitize to parse html.
I am trying to embed videos with iframe tags, but these get removed when textangular calls angular-sanitize to parsehtml.
How should I change angular sanitize to allow iframe tags with for e.g. links to youtube videos?
Or how else should I embed videos in my html?
This is how I did it.
textAngular is using a separate sanitize js file, textAngular-sanitize.min.js.
Even though it is minified, open it up, and you will find groups of tags; look for this :
A=b.extend({},x,e("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul"))
And just add the iframe tag
A=b.extend({},x,e("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,map,menu,nav,ol,pre,script,section,table,ul"))
I kept it in alpha order.
This makes it "safe", problem solved.
One option might be to change the text before you sanitize it, then change it back afterwards. Something like:
var text = 'some text <iframe></iframe> some more text';
text = text.replace('<iframe', '[[iframe');
text = text.replace('</iframe>', '[[/iframe]]');
text = sanitize(text);
text = text.replace('[[iframe', '<iframe');
text = text.replace('[[/iframe]]', '</iframe>');
But by doing that you're opening up yourself for attacks when embedding YouTube videos with an iframe. What you should do is come up with some internal BBCode which you replace just before printing it out. That is, you let your users pass something like [youtube video_id=ZZZ] which you replace with an iframe after you've sanitized it.

How to change the attributes of a .txt file using CSS?

I've inserted a .txt file in an html page using the object tag. But the text don't keep the parent's attributes. Here's the code: I set color:blue but the text is black.
#DESC {
color:blue;}
<div id="DESC"> <object data="document.txt" type="text/plain"></object> </div>
Including a text file using an <object> element is much like including one using an <iframe>. You create a viewport within your document which contains an independent document, CSS rules will not be inherited into the sub-document.
In Firefox (and possibly other browsers, but I haven't tested) you can use JavaScript to access the contentDocument property of the object (or iframe) and from there access the body (some browsers render text files by generating an HTML document representation of them) and modify the style.
In general, however, you would be better off including the text as part of the main document and then styling it normally. This could be as part of a static file, some form of server side include or (for the least reliable and search engine friendly approach) using the JavaScript XMLHttpRequest object.
css is only compatible with html
so the answer to your question is - you can not change a text file appearance with css

How can I use HTML tags as native tag into my ios application

I have to make a custom control in which I have to format HTML tag into native tag. Suppose I write:
label.text = #"<b><i>Hello World</i></b>
Then it should print Hello World in bold and italic format. I have to do it in for general HTML tags like <p>,<br>,<u>,<a href>,<img> etc.
The easiest way to do this is to use a UIWebView (since you can just put HTML in there.)
You can make the background of a UIWebView transparent to make it integrate with your app better.
The alternative for displaying formatted text in IOS is with CoreText.
Apple has an example on how to use CoreText here

Are html tags allowed as value of title attribute on image

I already found this existing question
Is this possible in XHTML: tags in a title-attribute?
...but it seems to be about browser-rendered title attribute.
I'm using a jQuery plugin to render the title attribute, called Tooltip by Flowplayer.
I can already tell you that the rendering of HTML tags contained in title attributes with this plugin WORKS. It shows nicely in FF3, IE7, IE8 and recent versions of Safari, Chrome and Opera.
My question is: is it "legit"?
I only found that the value of title attribute should be "text". Does it mean plain text or "string"?
Considering that most browsers display the HTML correctly with the jQuery plugin applied, would you think it's fair to put those tags, EVEN if they're not "officially" authorized ??
My answer would be to check out directly with a validator (http://validator.w3.org/). If the page is not on the web, open it in your browser and take the source code generated by jQuery and paste it in the validator's Direct Input tab.
If you want to know what is legit and what isn't, W3.org is the reference.
The W3C say on http://www.w3.org/TR/2011/WD-html5-20110525/elements.html#element-definitions
3.2.4.1 Attributes
Except where otherwise specified, attributes on HTML elements may have
any string value, including the empty string. Except where explicitly
stated, there is no restriction on what text can be specified in such
attributes.
This is a string value it is not markup (elements with or without attributes and text nodes). Firefox 19.0.2 and Chrome 25.0.1364.160 with no plugin, both display the raw string without trying to render it as markup. This I believe is the correct behaviour as an attribute is a text string not markup. So if you want to display html code it is fine (but it should really be html encoded) if you want to get a browser to render the html code without your JQuery plugin it is not going to happen. So your plugin is asking your browser to do something unnatural. Isn't there a better way to achieve the same effect?

How to add images into Adobe Flex RichTextEditor?

How to add images into Adobe Flex RichTextEditor control? I mean using a button =)
So we have some text editor with RTE a-la
editor screenshot http://livedocs.adobe.com/flex/3/html/images/RTE1.png
We want to get into its content images using some button. How to do such thing?
BTW: I found this http://anotherflava.com/2009/01/12/flex-xhtml-rich-text-editor-w-images/ but I really do not understand how to make it work so if any one can publish simple project with simple (DIRTY IS OK) source it would be grate!)))
RichTextEditor is a complex component which consist of few small components and TextArea. So the problem is how to insert image in TextArea.
TextArea can render simple HTML and <img> tag is supported. More about htmlText property here.
So
var myTextEditor:RichTextEditor = new RichTextEditor();
myTextEditor.htmlText = "<img src='myImage.jpg' />"