Flash: ASfunction Link Rollover Effect

External CSS

External css as it applies to dynamic text does have limitations Some of those limitations include:

  • javascript actions such as On rollover events in js.
  • Borders
  • divs and tables
  • text is always set to wrap which can cause formatting issues when dealing with images linked to in the content.

An easy way to overcome text wrap surrounding images is by usage of multiple <br.> tags <p> while it can be deployed via CreateTextfield + css does not handle in the same manner as it would standard css/html markup. All these things taken into account the gains of applying css to a Created textfield still offers more then can be achieved via conventional dynamic text methods.

Your .css file should be limited to the css which is pertainent to your text.  Here is a typical example of a css file.

p {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 12px;
display: inline;
}

a:link {
color: #00008B;
text-decoration: underline;
}

a:hover{
color: #FF8C00;
text-decoration: none;
}

.headline {
color: #0000FF;
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
font-weight: bold;
display: block;
color: #FF6600;
}

.byline {
color: #708090;
font-style: italic;
font-weight: bold;
display: inline;
}

A .css file can be created in any flat file editor such as notepad and needs to be saved with the .css extenion it provides external information on how
the text is to be formated. Tags in your html content refer back to the css element which defines the properties od the text to be presented.

Createtextfield

CreateTextfield is a method first used in swf6 that has been enhanced in 7 and 8 originally one could only use internal css with createtextfield. the internal css was not as practical as external
it had several limitiations. swf 7 was the first time loadcss() became fully implimented. It simplfied css for those whom had familairity with conventional css as well as before we delve to far into loadcss
llets explore createtextfield a little more fully.

onFrame (2) {
createTextField(“myText”, 1, 250, 110, 360, 400);
myText.type       = “dynamic”;
myText.autoSize   = “left”;
myText.multiline  = true;
myText.wordWrap   = true;
myText.html       = true;
myText.selectable = true;
myText wordWrap   = true;
myText.condenseWhite = false

//Hard code some HTML text to display (for example purposes)

MyContent =”Click on This is Cool”;

//Create a new style sheet object
var myCSS = new TextField.StyleSheet();
//Specify the location of the CSS file that you created earlier
var cssURL = “example.css”;
//Load CSS file
myCSS.load(cssURL);
//define onLoad handler
myCSS.onLoad = function(success) {
if (success) {
/* If the style sheet loaded without error,
assign it to the text object, and assign the HTML text to the
text field*/
myText.styleSheet = myCSS
myText.text = MyContent;
//this should be “.htmlText”,
// but Flash seems to recognise that the textbox needs to display html anyway

;
};
}
}

Thanks http://www.swishzone.com/index.php?area=resources&tab=tutorials&do=page&action=detailed&link_id=187

Leave a comment