I am following the great tutorial in this site at
http://www.flash-db.com/Tutorials/loading/loadingData.php?page=3, and I try to develop them according to my project. Thanks for the tutorial!
Here is my mymenu.xml
<?xml version="1.0"?>
<PORTFOLIO>
<section name="ABOUT"
text ="content/images/description1.txt"
picture="content/images/pic2.jpg"
/>
<section name="COMPANY"
text ="content/images/description2.txt"
picture="content/images/pic1.jpg"
/>
</PORTFOLIO>
and here is the actionscript:
contenttext = this;
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success){
menuSection = this.firstChild.childNodes;
for (var i=0; i<menuSection.length; i++) {
item = menu.attachMovie("itemClip", "itemClip" + i, i);
item._x = 0;
item._y = i*22;
item.itemLabel.text = menuSection[i].attributes.name;
item.text = menuSection[i].attributes.text;
item.picture = menuSection[i].attributes.picture;
//item.myUrl = menuSection[i].attributes.url;
item.onRelease = function() {
info_txt.text = "LOADING...";
contenttext.loadVariables(this.text);
containerMC.loadPic(this.picture);
}
}
containerMC.loadPic(menuSection[0].attributes.picture);
contenttext.loadVariables(menuSection[0].attributes.text);
} else {
loadText.text = "ERROR!";
}
}
menuXml.load("xmlstuff/myMenu.xml");
I want to make this project having lots of freedom in terms of how each menu item will react upon onRelease.
To illustrate my idea, Please kindly have a look at
item.onRelease=function()
{ }
Instead of having to have what is there, I want the onRelease function to have choices. My idea is that is going to be look like this :
item.onRelease=function(){
choice of actions();
}
then I can declare the choice of actions(); like
action_one.onRelease=function(){
info_txt.text = "LOADING...";
contenttext.loadVariables(this.text);
containerMC.loadPic(this.picture);
}
action_two.onRelease=function(){
info_txt.text = "LOADING...";
thumbnail.createThumbnail(this.thumbnail);
containerMC.loadMovie(this.picture);
getURL(this._blank);
}
I hope that snippets and the illustration able to show what I want to do.
So please, someone so kind helping me :
1. How to change the general item.onRelease funtion above to the item.onRelease with choice of actions, but all the attributes still intact?
2. How to decalre the action_one.function and action_two.function in order that each of the function has different kind of functions of function?
3. I will obviously will have to change mymenu.xml above to have attributes point out to the action. Can you please show me/rework that structure?
This is my first post and I hope it's not burried in the weekend avalanches.
Thanks a lot for your help.