Hi,
Im totally new to XML and i have a flash component in my website that uses XML. It's called newsblock. it tells me to put an XML doc in the same file as my swf with the component.
Now here is my XML:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<news>
<date>04/05/2006</date>
<title_of_the_news>Welcome</title_of_the_news>
<news_text>Welcome to my website. this is the first news im writing in this website so have fun!</news_text>
</news>
Now if you check out http://www.benjidela.com, it doesn't work...
PS: Here is the actionscript in the component:
Code:
#initclip
function newsBlock() {
_global.ref = this;
this.init();
}
newsBlock.prototype = new MovieClip();
Object.registerClass("newsBlock",newsBlock);
// init
newsBlock.prototype.init = function() {
ref._x = Math.round(ref._x);
ref._y = Math.round(ref._y);
ref.componentWidth = ref._width;
ref.componentHeight = ref._height;
ref._xscale = ref._yscale=100;
ref.boundingBox_mc._visible = false;
ref.add_borders();
ref.attachMovie("textBlock_mc","textBlock_mc",5)
ref.textBlock_mc.news_txt.html=true
ref.textBlock_mc.news_txt.selectable=ref.t_select
ref.textBlock_mc.news_txt.textColor=this.t_color.toString(16)
ref.textBlock_mc.news_txt.text = "loading XML data";
ref.setSize(ref.componentWidth, ref.componentHeight);
//
//----------
var newsXML = new XML(this);
newsXML.ignoreWhite = true;
newsXML.onLoad = function(success) {
if (success) {
if (this.loaded && this.hasChildNodes) {
ref.news_content = new Array();
ref.news_date = new Array();
if (this.firstChild.nodeName.toLowerCase() == "newsblock") {
var nm = this.firstChild.childNodes;
for (var i = 0; i<=nm.length; i++) {
if (nm[i].nodeName == "news") {
ref.news_date.push(nm[i].attributes.date);
ref.news_content.push(nm[i].firstChild.nodeValue);
}
}
}
}
ref.show_news2();
}
};
newsXML.load("newsblock.xml");
};
newsBlock.prototype.add_borders = function() {
this.attachMovie("border_up", "border_up", 1);
this.attachMovie("border_down", "border_down", 2);
this.attachMovie("border_left", "border_left", 3);
this.attachMovie("border_right", "border_right", 4);
};
newsBlock.prototype.show_news = function(n) {
ref.textBlock_mc.news_txt.htmlText = "<FONT COLOR='#"+ref.d_color.toString(16)+"'>"+ref.news_date[n]+"</FONT>"+"<br>"+"<FONT COLOR='#"+ref.t_color.toString(16)+"'>"+ref.news_content[n]+"</FONT>" +"<br><A HREF=\"asfunction:ref.show_news2,"+i+"\"><FONT COLOR='#"+ref.l_color.toString(16)+"'><u>back to news>></u></FONT></A> <br><br>";
};
newsBlock.prototype.show_news2 = function() {
var cnt = ref.news_content.length;
ref.textBlock_mc.news_txt.text = "";
if(!ref.sf_news){
for (var i = 0; i<cnt; i++) {
ref.textBlock_mc.news_txt.htmlText += "<FONT COLOR='#"+ref.d_color.toString(16)+"'>"+ref.news_date[i]+"</FONT>"+"<br>"+"<FONT COLOR='#"+ref.t_color.toString(16)+"'>"+ref.news_content[i].substring(0, ref.n_symbol)+"</FONT>"+"...<br><A HREF=\"asfunction:ref.show_news,"+i+"\"><FONT COLOR='#"+ref.l_color.toString(16)+"'>"+"<u>more>></u></FONT></A> <br><br>";
}
}else{
for (var i = 0; i<cnt; i++) {
ref.textBlock_mc.news_txt.htmlText += "<FONT COLOR='#"+ref.d_color.toString(16)+"'>"+ref.news_date[i]+"</FONT>"+"<br>"+"<FONT COLOR='#"+ref.t_color.toString(16)+"'>"+ref.news_content[i]+"<br><br>";
}
}
};
// setSize
newsBlock.prototype.setSize = function(w, h) {
this.componentWidth = Math.round(w);
this.componentHeight = Math.round(h);
this.boundingBox_mc._width = Math.round(w);
this.boundingBox_mc._height = Math.round(h);
var tmp = 4;
this.border_up._x = 0;
this.border_up._y = 0;
this.border_up._width = this.boundingBox_mc._width-tmp-16;
this.border_left._x = 0;
this.border_left._y = this.border_up._height;
this.border_left._height = this.boundingBox_mc._height-this.border_up._height-this.border_down._height;
this.border_down._x = 0;
this.border_down._y = this.border_up._height+this.border_left._height;
this.border_down._width = this.border_up._width;
this.border_right._x = this.border_up._width-this.border_right._width;
this.border_right._y = this.border_up._height;
this.border_right._height = this.border_left._height;
this.textBlock_mc.news_txt._x = this.border_left._width;
this.textBlock_mc.news_txt._y = this.border_up._height;
this.textBlock_mc.news_txt._width = this.border_up._width-this.border_left._width-this.border_right._width
this.textBlock_mc.news_txt._height = this.border_left._height-this.border_up._height-this.border_down._height
};
#endinitclip
Any clues??
__________________
forum-------> Please login or register to view this content. Registration is FREE, for people who wants to have a good time ;)
website------> Please login or register to view this content. Registration is FREE (might be in construction :D)
Hope you have a great time and that my post is helpfull ;)
Last edited by lizard dude; 04-06-2006 at 11:49 AM..
|