17 April 2007

Style links in Flash with CSS

A friend asked me if they could style html links in Flash. Prior to Flash 7 you couldn’t … i said sure … just google it ... you should be able to add styles to dynamic text area …

I was surprised and shocked when they came back to me 4 days later … saying that they tried … and started making buttons to achieve the rollover states … I then googled myself and saw that it was hard to find … and even though I have used Flash for ages … I have never done this …. but I found it and decided to post it … before Flash 7 it was not possible … and links had no rollover states…


The link here are either html or links to asfunction …

da code…

var styles = new TextField.StyleSheet();
styles.onLoad = function(ok) {
	if (ok) {
		dynbox.styleSheet = styles;
		//looks like you need to trigger 
		//a change for it to display
		dynbox.htmlText += ''; 


The secret is with TextField.styleSheet »

Now the example shows exactly how to do with HTML, but there is another way … inside a dynamic textfield you can select text and use the link tool to add URLS ... OR flash functions using asfunction:some_function_name … and voila … those too are styled !!

da source…



Site has been moved

nuff-respec.com is no longer being updated. Please head over to dbulli.com for new content