Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update menu text outside of flash

Status
Not open for further replies.

jefargrafx

Instructor
May 24, 2001
273
US
so I want to be able to update a horizonal menu from outside of flash.

so I put the code in an script.as and incldue it on the first frame.

I attach a movie clip out of the library over adn over again.

here is a snibit of the code:

//first menu
_level0.attachMovie("holder", "menu_01", 1);
//update the next line to change the menu title
_level0.menu_01.fldMenu_MC.txt = &quot;<b>This is a test of the american broadcasting system</b>&quot;;
////////////////////////////////////////////////////////////////////////////
_level0.menu_01._x = _level0.menu_01.fldMenu_MC.fldMenu.textWidth / 2 + 20;
_level0.menu_01._y = _level0._height / 2;


//second menu
_level0.attachMovie(&quot;holder&quot;, &quot;menu_02&quot;, 2);
//update the next line to change the menu title
_level0.menu_02.fldMenu_MC.txt = &quot;<b>reguadless of how big this field is it will alway positio it self 20px frome the pervious flield</b>&quot;;
////////////////////////////////////////////////////////////////////////////
_level0.menu_02._x = _level0.menu_01.fldMenu_MC.fldMenu.textWidth / 2 + 20 + _level0.menu_01.fldMenu_MC.fldMenu.textWidth / 2 + _level0.menu_02.fldMenu_MC.fldMenu.textWidth / 2 + 20;
_level0.menu_02._y = _level0.menu_01._y;

works fine,

but what I want to know is, there an easier way to do this,

considering simi-techie people will be doing the updating.

here you have to copy a block, change the level and then update the menu text,

I'd just liek to update the menu text?

any ideas?



jef
 
oh don't forget you'd have to update the referring object number, I guess that's the real problem?

fyi

jef
 
why just not keep all the info that will be updated in an external text file. that way you can include explanations of what to change and where and it keeps it all as simple as possible.

im not sure id want others messing with the .as file where just the inclusion or ommission of something crucial could cause a crash.
 
yes I see what you mean,

but I was think of more complex code to make the update easier,

like maybe

in an external file

number_of_menus = 10;
a loop that will make the fields and position them according to there size
(no idea here)

menu01 = &quot;text&quot;
menu02 = &quot;more text&quot;

so forth and so one

what do ya think?

jef
 
text file

&menu0=text&
&menu1=more text&

&numItems=2&


flash

mydata = new loadvars();
mydata.onload = function(){
numItems = myData.NumItems;
for (i=0; i<numItems; i++){
var Name = eval(&quot;myData.menu&quot;+i);
//probably just stick them all into an array for ease of retrieval
}
mydata.load(&quot;menu.txt&quot;);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top