We help IT Professionals succeed at work.

html inside flash cs3 problem

derrida
derrida asked
on
533 Views
Last Modified: 2013-11-11
Hi
i`m building someone an rss reader with flash. my problem in the description tag i get some html elements.
i have tryied to tell:  text_txt.htmlText =   but then the whole content does not show. i think it is  because flash does not support all html elements.
what one can do?


ron
Comment
Watch Question

Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi blue

so you say what i thought: there is no way to make flash accept the html. and i need to make it as strip it.
i hoped there is something i did not thought about.

thanks.

ron

Author

Commented:
Hi blue

how can i strip only the tags AS3 does not support?


ron
Hey derrida,

I'm building an RSS reader for myself and my RSS file contains HTML tags.  I too would like to maintain this formatting when displaying my RSS feed.  However, I have not yet found a complete solution.  

I came across this chapter in the ActionScript 3.0 Cookbook, it is a meager single page I've attached as a Word document.

I also found some helpful information on the Adobe website here:
Using HTML text formatting in Flash CS3 Professional: http://www.adobe.com/go/tn_14808

It looks like Flash will interpret certain HTML tags naively.  Here is what I have at the moment.  It is far from finished and I am open to suggestions and advice.  Notice that at the moment I am hard coding my HTML tag.  



import fl.events.*;
import fl.data.DataProvider; 
import fl.controls.TextArea;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
XML.ignoreComments = false;
XML.ignoreProcessingInstructions = false;
 
// ______________________________________// ______________________________________
var xmlLoader:URLLoader  = new URLLoader();
var xml:XML;
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
blogList_mc.addEventListener(Event.CHANGE, itemChange);
xmlLoader.load(new URLRequest("myRSS.xml"));
blogList_mc.alpha= 0.7;
// ______________________________________// ______________________________________
function LoadXML(e:Event):void 
{
	// ______________________________________
	var txtFormat:TextFormat = new TextFormat();
	txtFormat.color = 0x000000;//0xf1f1f1;
	txtFormat.leftMargin = 20;
	txtFormat.rightMargin = 20;
	txtFormat.font = "arial";
	content_txt.wordWrap = true;
	content_txt.selectable = true;
	content_txt.multiline = true;
	content_txt.defaultTextFormat = txtFormat;
	// ______________________________________
	xml = new XML(e.target.data);
	ParseBlog(xml);
}
 
// ______________________________________// ______________________________________
 
function itemChange(e:Event):void
{
	content_txt.htmlText = blogList_mc.selectedItem.data;
	//title_txt.text = blogTitle;
}
// ______________________________________// ______________________________________
function ParseBlog(blogInput:XML):void  
{ 
	var il:XMLList = xml.channel.item;	
	for(var i:uint=0;i<il.length();i++)
	{ 		
		blogList_mc.addItem({label:il.title.text()[i],data:il.pubDate.text()[i] + "\n\n" + "<b>" + il.link.text()[i] + "</b>" + "\n\n" + il.description.text()[i]});		
	}	
}

Open in new window

Recipe-9-8.doc
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.