Linking with Dynamic Text & CSS problem

After doing the tutorial on kirupa for using css, I wanted to create text links to other frames in my movie. So I searched the forums and came across kode’s really helpful info on creating them. But when i try to incorporate the two i just cant seem to pull it off.

Basically i’m trying to attach a css to the below code, but due to my action script skills fail.

Text Links Code:
[COLOR=royalblue]_root.myText.htmlText = ‘<a href=“asfunction:gotoAndStop,myFrame”>Click here and goto my frame</a>’;[/COLOR]

CSS code:
[COLOR=royalblue]var format = new TextField.StyleSheet();
var path = “http://www.juxtapozed.com/testing/personal/juxtstyle.css”;
var quick = “<h3>This is s test.</h3><p>This is s test<br>This is s testThis is s testThis is s test</p><h4>Click here to see This is s test.<h4>”
format.load(path);
format.onLoad = function(success) {
if (success) {
output.styleSheet = format;
output.text = quick;
} else {
output.text = “Error loading CSS file!”;
}
};[/COLOR]

any help will be much appreciated . juxatpozed.

hey juxtapozed

maybe try this:

//declare a function (textLink) in your flash movie like so

_global.textLink = function() {
_root.gotoAndStop(“myLabel”)

}

//then call to this function using the asfunction in your htmlText
<a href=‘asfunction:textLink’><b>text link</b></a>

cheers!

jdean

Welcome to kirupaForum, juxtapozed! :slight_smile:

You have to HTML enable the text field (you can do this via the [font=courier new]TextField.html[/font] property, or selecting “Render text as HTML” in the Properties panel), and assign the HTML formatted text to the text field through the [font=courier new]TextField.htmlText[/font] property. :wink:

Try this:

format.onLoad = function(success) {
if (success) {
output.html = true;
output.styleSheet = format;
output.htmlText = quick;
} else {
output.text = "Error loading CSS file!";
}
};

Thanks guys, sorted, much appreciated!

No problem. :stuck_out_tongue:

…By the way, please use the ActionScript tag [AS][/AS] to display your code next time. :slight_smile: