Showing posts with label Flash. Show all posts
Showing posts with label Flash. Show all posts

Monday, 17 September 2007

Flash with CSS and XML



On clicking each menu or tab, the corresponding xml file content will be loaded in the tab area with the css formatting applied to it.

The output will be as follows. The heading and content styles are applied through CSS.

Mail me if you need the complete source files.









Action script code
------------------

//
function hideText() {
mypara._alpha = 0;
mypara.text = "";
mypara.visible = false;
}
//mypara._alpha = 0;
//mypara.visible = false;
hideText();

function XmlBase(xmlPath) {
mypara.visible = true;
mypara._alpha = 100;
//init TextArea component
mypara.html = true;
mypara.wordWrap = true;
mypara.multiline = true;
mypara.label.condenseWhite = true;
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("kungfu.css");
mypara.styleSheet = kungFuStyle;
//trace(mypara.styleSheet);
//load in XML
kungFuContent = new XML();
kungFuContent.ignoreWhite = true;
// kungFuContent.load("one.xml");
kungFuContent.load(xmlPath);
kungFuContent.onLoad = function(success) {
if (success) {
mypara.text = kungFuContent;
}
};
}
function callFromInside(xmlPath) {
XmlBase(xmlPath);
}
btn_One1.onRelease = function() {
XmlBase("one.xml");
};
btn_two.onRelease = function() {
XmlBase("two.xml");
};
btn_three.onRelease = function() {
XmlBase("three.xml");
};
btn_four.onRelease = function() {
XmlBase("four.xml");
};
btn_five.onRelease = function() {
XmlBase("five.xml");
};
btn_six.onRelease = function() {
XmlBase("six.xml");
};
dem_ctn.onRelease = function() {
hideText();
};
btn_Home.onRelease = function() {
hideText();
};

//



CSS code - kungfu.css
-----------

heading{
color: #FF0000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
display: block;
}

text{
color: #000000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
display: block;
}

 
© The contents of all personal web pages and blogs are published by me. Statements made and opinions expressed are strictly those of the me and not my employer.