Application of HTML and CSS in Flash_HTML/Xhtml_Webpage Production
- WBOYOriginal
- 2016-05-16 16:44:281543browse
Application of HTML and CSS in Flash:
I accidentally saw my colleague Den working on a little thing: using HTML and CSS in Flash. The code is as follows:
var myStyle:TextField.StyleSheet = new TextField.StyleSheet();
myStyle.load("sample.css");
content_txt.styleSheet = myStyle;
content_txt.multiline= true;
content_txt.wordWrap = true;
content_txt.html = true;
var story:XML = new XML();
story.ignoreWhite = true;
story.load("sample.html ");
story.onLoad = function () {
content_txt.htmlText = story;
}
This is to load external CSS and HTML (actually, use -_-b to load XML as HTML). Later Den wrote two ways to write styles in AS:
var css_str:String = ".aoao{color:#010101;font-weight:bold;} .aoao:hover{color:#ff0000}";
myStyle.parseCSS(css_str)myStyle.setStyle(" .aoao", {color:'#010101', fontWeight:'bold'});
myStyle.setStyle(".aoao:hover", {color:"#ff0000"});
In fact, HTML can also be written in AS, just spell string directly. Whether CSS is written in AS or loaded from external CSS depends on the situation. When using the Web, you also need to consider the number of requests, file size, cache, and more importantly, maintenance costs. However, I have not thought of any more suitable applications for Web applications. It does not make much sense to use HTML to load Flash in the browser and then use Flash to load HTML and CSS. Moreover, the support is not generally weak. Take a look at the supported HTML tags and CSS properties, =. = I originally wanted to use it to solve the problem of Chinese underlines, but it still didn't work. I heard that others used flash to draw underlines.
Just play around with the browser app. Let’s stay in the desktop app.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn