/********************************************************************************
* @ File: scrollcss.php
* @ Original date: August 2003 @ www16.brinkster.com/gazb/ming/
* @ Version: 1.2
* @ Summary: made with ming cvs & a hex editor (its a bit of a quick hack...)
* @ Updated: small improvements and summary text
* @ Copyright (c) 2003-2007, www.gazbming.com - all rights reserved.
* @ Author: gazb.ming [[@]] gmail.com - www.gazbming.com
* @ Released under GNU Lesser General Public License - http://www.gnu.org/licenses/lgpl.html
********************************************************************************/
// some typical movie variables
Ming_setScale(20.0000000);
ming_useswfversion(6);
$movie=new SWFMovie();
$movie->setDimension(550,400);
$movie->setBackground(rand(0,0xFF),rand(0,0xFF),rand(0,0xFF));
$movie->setRate(12);
$strAction="
// make properties of class available to SWF6
ASSetPropFlags(class.prototype, null, 0, 1024);
function updateOutput() {
txf= TextField.StyleSheet;
myStyleSheet = new txf();
myStyleSheet.parseCSS(mycss);
txtFld.styleSheet = myStyleSheet;
txtFld.htmlText = str;
}
mycss='.heading {color: #000000; font-family: Verdana, Arial, sans-serif; font-size: 18px; font-weight: bold;}
.copy {color: #0000CC; margin-left: 10px; margin-right: 5px;font-size: 14px;}
.code {margin-left: 20px; margin-right: 15px; font-family: Andale Mono, Courier New, Courier, monospace; font-size: 14px;}
.comment {color: #999999; font-size: 12px;}
.string {color: #0000FF;font-size: 12px;}
.keyword {color: #000099;font-size: 12px;}
a {color: #0000ff;font-size: 12px;}
a:hover {color: #ff0000; text-decoration: underline;font-size: 12px;}';
_root.createTextField('txtFld',++depth,20,20,450,200);
with(txtFld){ border = true; html = true; wordWrap=true;}
str = '';
// add image
str += '
';
str+='Welcome to the future...
This is the future of Flash textfields! This text should keep a 20px hanging indent thanks to the margin-left attribute of the .copy pseudo class.
Below is some basic code for applying CSS to a TextField object...
// Define styles styles_str = \".pink {color: #ff3399;}\"; // Create new StyleSheet object my_css = new TextField.StyleSheet(); // Parse styles into StyleSheet my_css.parseCSS(styles_str); // Apply StyleSheet to text field output_txt.styleSheet = my_css;
Another major breakthrough is that We can now apply hover styles to links, just as you would with normal HTML!
Feel free to play around using the textfields on the left. Youll find that there are still lots of aspects of HTML not supported (at least I cant find a way to get them to work), but this is going to be sooo much better than before!
Incidentally, you can now have images or swf files in a textfield now - aligned left or right - using an <IMG> tag, with the text flowing around the image.'; for(i=0;i<40;i++){str += ' some more text to test scrolling ';} str +='--------------END-------------------------'; // set scrollwheel txtFld.scrollWheelEnabled = true; // insert text txtFld.htmlText = str; updateOutput(); "; $movie->add(new SWFAction($strAction)); // save swf with same name as filename $swfname = basename(__FILE__,".php"); $movie->save("$swfname.swf",9); ?>