[FONT=Arial] Hi All,
This is my first post to this forum, and I am afraid that it will be quite a long one
I am creating a Flash Application that generates a group of menu buttons from an XML file. After being created through actionscript, these buttons each load a different flashpaper file. The paths to these flashpaper files are also defined in the XML. This is all working thank god!
My problem is that when the flashpaper files load into my project, they load at a default width and height (I beleive it is 550px by 400px). This leaves me with a problem. I want to be able to customize the height and width of these files through actionscript.
I have tried using an additional “holder” SWF for each flashpaper file. That “holder” SWF loads the flashpaper through actionscript on the first frame. It uses the flashpaper API to resize the flashpaper, and this all works just fine. The problem here is that for every flashpaper SWF I have, I have to create a “holder” SWF file for it. This sort of defeats the purpose of using XML. The whole point of creating the Application was to allow my client to easily add/remove flashpaper files without changing the flash actionscript! If they have to create a new “holder” SWF for every new flashpaper file they want to add, they would need me to create those SWF files. Furthermore, this method would double the amount of SWFs in my project.
I don’t care if the flashpaper files are loaded into a movieclip, or into a seperate layer. As long as I can resize them without using another SWF in the process, that would be awesome. Let me know if anyone can think of a way to accomplish this. *One last thing to note is that the path to each flashpaper file is defined by a unique instance variable for the chosen menu button (this.url_text). So the path to the file cannot be absolute like (“folder1/flashpaperfile.swf”). This throws the final wrench into the mix. I have attached the code that I have working so far. Thanks everyone!!!
[/FONT]
** Here is the code:**
function DisplayFile(){
-
//this loads the flashpaper into another movie clip*
displayfile_mc.fileholder_mc.loadMovie(this.url_text) -
//this loads the flashpaper into a new layer, either method is fine with me… as long as I can resize it… I would also be able to access the flashpaper API here if possible, but it is not a necessity… I really just want to resize the flashpaper SWF*
//{loadMovieNum(this.url_text,5);
//}
}
var item_spacing = 28;
var item_count = 0;
function CreateMenu(menu_xml){
var items = menu_xml.firstChild.firstChild.childNodes;
for (var i=0; i
- //check folder name by attribute “folder” (this group of files are in folder “set1”)*
if (items*.attributes.folder == “set1”) {
var filename = items*.attributes.filename;
var url = items*.attributes.url;
var sourceurl = items*.attributes.sourceurl;
var item_mc = menu_mc.attachMovie(“menu_item”,“item”+item_count, item_count);
item_mc._y = item_count * item_spacing;
item_count++;
item_mc.filename_txt.text = filename;
item_mc.main_btn.url_text = url;
- //this is where the specific menu button instance calls the DisplayFile function from the top*
item_mc.main_btn.onRelease = DisplayFile;
}
}
}
var fileList_xml = new XML();
fileList_xml.ignoreWhite = true;
fileList_xml.onLoad = function(success){
if (success) CreateMenu(this);
else trace(“Error loading XML file”);
}
fileList_xml.load(“fileList.xml”)