Link to home
Start Free TrialLog in
Avatar of derrida
derrida

asked on

html inside flash cs3 problem

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
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of derrida
derrida

ASKER

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
Avatar of derrida

ASKER

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