# Newbie TellTarget script problems

**URL:** <https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305>\
**Category:** Uncategorized\
**Created:** [April 12, 2006, 11:59am UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305 "2006-04-12T11:59:03Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 11:59am UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/1 "2006-04-12T11:59:03Z")

</div>

ok so here goes:

i have been follwing the follwing tutorial: [http://www.flashkit.com/tutorials/A…\_S-89/index.php](http://www.flashkit.com/tutorials/Actionscripting/Expert/Dynamica-Joshua_S-89/index.php)

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

Please help asap Cheers  
Alex

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 12:05pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/2 "2006-04-12T12:05:48Z")

</div>

tellTarget is an older method, try:

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.

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 12:22pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/3 "2006-04-12T12:22:53Z")

</div>

> [@kortexvfd](#):
>
> tellTarget is an older method, try:
> 
> 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.

that work but now when i go to publish settings and change to action script 2 i get the following errors:

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=1:Line 2: Unexpected ‘/’ encountered  
if (/:menu\_loaded eq 1) {

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)) {

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 5: ‘)’ or ‘,’ expected  
duplicateMovieClip(“menu\_template”, “item\_” add x, x);

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 6: ‘)’ expected  
tellTarget (“item\_” add x) {

referring to the script:

// 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();

please help

Alex

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 12:28pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/4 "2006-04-12T12:28:19Z")

</div>

that work but now when i go to publish settings and change to action script 2 i get the following errors:

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=1:Line 2: Unexpected ‘/’ encountered  
if (/:menu\_loaded eq 1) {

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)) {

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 5: ‘)’ or ‘,’ expected  
duplicateMovieClip(“menu\_template”, “item\_” add x, x);

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 6: ‘)’ expected  
tellTarget (“item\_” add x) {

referring to the script:

// 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();

please help

Alex

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 12:44pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/5 "2006-04-12T12:44:03Z")

</div>

Thats cause it seem this script is all done in old AS 1 format. You are going to have to update the whole thing.

For example this:  
if (/:menu\_loaded eq 1) {

needs to be:

if (\_root.menu\_loaded == 1) {

and the other code(is an absolute mess LOL):

var item\_spacing:Number = 140;  
for (x=1; \<= menu\_count; x++){  
duplicateMovieClip(“menu\_template”, “item\_”+x, x);  
_root["item_"+x].menu\_text = [menu\_text\_+x];  
_root["item_"+x].menu\_link = [menu\_link\_+x];  
_root["item_"+x].gotoAndStop([menu\_state\_+x]);  
_root["item_"+x].\_x = _root["item_"+(x-1)].\_x +_root["item_"+(x-1)].\_width + \_root.item\_spacing;  
}  
stop();

is as close as I can come to translating what you posted.

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 1:14pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/6 "2006-04-12T13:14:25Z")

</div>

> [@kortexvfd](#):
>
> Thats cause it seem this script is all done in old AS 1 format. You are going to have to update the whole thing.
> 
> For example this:  
> if (/:menu\_loaded eq 1) {
> 
> needs to be:
> 
> if (\_root.menu\_loaded == 1) {
> 
> and the other code(is an absolute mess LOL):
> 
> var item\_spacing:Number = 140;  
> for (x=1; \<= menu\_count; x++){  
> duplicateMovieClip(“menu\_template”, “item\_”+x, x);  
> _root["item_"+x].menu\_text = [menu\_text\_+x];  
> _root["item_"+x].menu\_link = [menu\_link\_+x];  
> _root["item_"+x].gotoAndStop([menu\_state\_+x]);  
> _root["item_"+x].\_x = _root["item_"+(x-1)].\_x +_root["item_"+(x-1)].\_width + \_root.item\_spacing;  
> }  
> stop();
> 
> is as close as I can come to translating what you posted.

after chnaging you suggested codes then upgrading the publish setting to flash 8 actions cript 2 it outputs the following error:

**Error** Symbol=Menu Item Group, layer=Action Scripts, frame=3:Line 3: Unexpected ‘\<=’ encountered  
for (x=1; \<= menu\_count; x++){

Total ActionScript Errors: 1 Reported Errors: 1

please have patience with me and help

Alex

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 1:19pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/7 "2006-04-12T13:19:21Z")

</div>

Sorry about that, that was amistake on my end I left out  
for (x=1; \*\*x \*\*\<= menu\_count; x++){

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 1:31pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/8 "2006-04-12T13:31:43Z")

</div>

> [@kortexvfd](#):
>
> Sorry about that, that was amistake on my end I left out  
> for (x=1; \*\*x \*\*\<= menu\_count; x++){

No errors but now it does not duplicate the menu i have attatched the file to try and show you what i am trying to do please help this is killing me:

Alex

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 2:30pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/9 "2006-04-12T14:30:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 2:50pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/10 "2006-04-12T14:50:29Z")

</div>

> [@kortexvfd](#):
>
> 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.

that seem to make sense however it appear to make one extra button although i have dragged it of the screen and it still works so cheers…

however (the problem continues) if i wanted to to have the following file structure

Main Menu which would activate a button containing the code:

on (release) {  
if (\_root.currMovie == undefined) {  
\_root.currMovie = “assets/swf/MenuTemplate”;  
container.loadMovie(“assets/swf/MenuTemplate.swf”);  
} else if (\_root.currMovie != “assets/swf/MenuTemplate”) {  
if (container.\_currentframe \>= container.midframe) {  
\_root.currMovie = “assets/swf/MenuTemplate”;  
container.play();  
}  
}  
}

Which would open the extenral swf “Menutemplate” (this has transitions found in the tutorial in Hirupa (transitions between external texts).

then the menutemplate would act as another container for the menus

container.loadMovie(“assets/swf/menus/Menu.swf”);

This dosnt work? Why?

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 2:58pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/11 "2006-04-12T14:58:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 3:00pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/12 "2006-04-12T15:00:05Z")

</div>

> [@kortexvfd](#):
>
> 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.

how would i solve this problem?

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 3:02pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/13 "2006-04-12T15:02:10Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 3:04pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/14 "2006-04-12T15:04:14Z")

</div>

> [@kortexvfd](#):
>
> 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();

Sorry i must be a pain but where would this go?

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 3:17pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/15 "2006-04-12T15:17:04Z")

</div>

> [@nemedia](#):
>
> Sorry i must be a pain but where would this go?

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:

Error opening URL “file:///C|/Documents%20and%20Settings/alex%2Dwork/Desktop/Betatest/Flash/menu.xml”

when i select the button with the following action script:

on (release) {  
if (\_root.currMovie == undefined) {  
\_root.currMovie = “assets/swf/MenuTemplate”;  
container.loadMovie(“assets/swf/MenuTemplate.swf”);  
} else if (\_root.currMovie != “assets/swf/MenuTemplate”) {  
if (container.\_currentframe \>= container.midframe) {  
\_root.currMovie = “assets/swf/MenuTemplate”;  
container.play();  
}  
}  
}

how do i solve this?

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 12, 2006, 5:28pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/16 "2006-04-12T17:28:14Z")

</div>

did you move the XML file to the same folder when you moved the movie?

Also, if this SWF is in an HTML page, the XML actually has to be in the same folder as the HTML page that holds the SWF.

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 12, 2006, 5:59pm UTC](https://forum.kirupa.com/t/newbie-telltarget-script-problems/185305/17 "2006-04-12T17:59:32Z")

</div>

> [@kortexvfd](#):
>
> did you move the XML file to the same folder when you moved the movie?
> 
> Also, if this SWF is in an HTML page, the XML actually has to be in the same folder as the HTML page that holds the SWF.

i have stipped down my first movie and used your menu to show my problem:

i am trying to load the menu\_2 movie as an external movie into start.swf

Error opening URL “file:///C|/Documents%20and%20Settings/alex%2Dwork/Desktop/New%20Folder%20%282%29/menu.xml”

when i move the xml file into the dierectory with the star.swf resides it crashes flash

the reason for the flile organisation is essential in some form as required by the assesment i am trying to fulfill

really it needs to be:

rootfolder/start.swf  
rootfolder/assets/swf/menu\_2.swf  
rootfoler/assets/images/  
roofolderassrts/txts/

which folder do i put the xml?
