which teaches how to use an externa txt file to create a menu system, this works great however ive got myself stuck now that im trying to use it to my own devices i now want this meny system to laod as a container which i have succeeded in doing to a point!
the idea is as follows MenuTemplate action script is as follows:
container.loadMovie(“menus/Menu.swf”);
stop();
this loads the menu in fine however when selecting a button i get the following error:
Target not found: Target="/test" Base="_level0.container.menu.item_1"
i think it is looking at the follwing code within the menu.swf:
on (release) {
// Setting a variable at the root level of the movie is vital to keeping the function abstract enought to work for any menu item. Remember that menu_link was set by this clip’s host, “Menu Item Group”.
/:goto_link = menu_link;
tellTarget ("/test") {
gotoAndStop(/:goto_link);
}
}
it also appears that this scripting dosnt work with action script 2, i need to find a way of re coding this without having to use a different tutroial please help
on (release) {
// Setting a variable at the root level of the movie is vital to keeping the function abstract enought to work for any menu item. Remember that menu_link was set by this clip’s host, “Menu Item Group”.
_root.goto_link = menu_link;
_root.test.gotoAndStop(_root.goto_link);
}
would be the AS2 way of doing that. You have to watch some of the tutorials on Flashkit as the show really old methods of doing things.
reffering to:
// This checks to see if all the variables have been loaded yet. Remember, the last variable in the text field is menu_loaded, so if it equals 1, all the other variables must have been loaded.
if (/:menu_loaded eq 1) {
gotoAndPlay(“create_menu”);
}
and the following errors:
Error Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 4: Operator ‘<=’ must be followed by an operand
while (Number(x)<=Number(/:menu_count)) {
// This loop duplicates a template movie clip and prepares it based on the information set in “menudata.txt”.
item_spacing = 140;
x = 1;
while (Number(x)<=Number(/:menu_count)) {
duplicateMovieClip(“menu_template”, “item_” add x, x);
tellTarget (“item_” add x) {
menu_text = eval(“/:menu_text_” add …/:x);
menu_link = eval(“/:menu_link_” add …/:x);
gotoAndStop(eval(“/:menu_state_” add …/:x));
setProperty(“”, _x, Number(getProperty(“”, _x))+Number((…:item_spacing*(…/:x-1))));
}
x = Number(x)+1;
}
stop();
reffering to:
// This checks to see if all the variables have been loaded yet. Remember, the last variable in the text field is menu_loaded, so if it equals 1, all the other variables must have been loaded.
if (/:menu_loaded eq 1) {
gotoAndPlay(“create_menu”);
}
and the following errors:
Error Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 4: Operator ‘<=’ must be followed by an operand
while (Number(x)<=Number(/:menu_count)) {
// This loop duplicates a template movie clip and prepares it based on the information set in “menudata.txt”.
item_spacing = 140;
x = 1;
while (Number(x)<=Number(/:menu_count)) {
duplicateMovieClip(“menu_template”, “item_” add x, x);
tellTarget (“item_” add x) {
menu_text = eval("/:menu_text_" add …/:x);
menu_link = eval("/:menu_link_" add …/:x);
gotoAndStop(eval("/:menu_state_" add …/:x));
setProperty("", _x, Number(getProperty("", _x))+Number((…:item_spacing*(…/:x-1))));
}
x = Number(x)+1;
}
stop();
This version runs on XML as opposed to a text file. This would be more modern. It does basically what the old one does. Save the XML and the SWF in the same folder.
yeah the “extra” button is the original clip that gets duplicated.
As far as the loading goes, you are realoding into the same container clip on the same level, any time you do that, the new contents replace the old ones.
if you know the instance name of the clip within the clip you have loaded, I suppose you could load another clip into that:
_root.container.clipInsideName.loadMovie();
ignore the last question i hace placed the menu within the same folder as the menu template which seems to solve the extra button aswell . however when i go back to the start swf it come up with the error message: