1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
sections = ["CAMPUS and LOCAL LIFE","WELFARE ","MONEY ","EMPLOYMENT ","INTERNATIONAL STUDENTS","HOUSING ","LIBRARY and COMPUTING","ACADEMIC SUPPORT"];
sections["CAMPUS and LOCAL LIFE"] = ["nursery","eating","Car Parking"];
sections["WELFARE"] = ["1","2","3","4"];
var globale:Number = 0;
function createButtonsSections()
{
var nom_tf = "texte"; //nom des TextField
var nom_mc = "mc"; //nom des MovieClip
var Longueur = 170; //largeur du nouveau champ texte
var Hauteur = 30; //hauteur du nouveau champ texte
for(i=0; i<sections.length;i++) //tant qu'on atteint pas la fin du tableau
{
_root.createEmptyMovieClip(nom_mc+i,i); //creation d'un nouveau MovieClip
x = eval(nom_mc+i); //variable egale au nom du Movieclip
x._x = 20; //coordonnees en x
x._y = i* 35; //coordonnees en y
_root.x.createTextField(nom_tf+i,i,x._x,x._y,Longueur,Hauteur); //creation d'un nouveuau textField
with (_root.x[nom_tf+i])
{
text = sections[i]; //texte a afficher
type = "dynamic"; //type du TextField
selectable = false; // empeche la selection
}
}
globale = sections.length;
}
var nomSection:String;
function createButtonsSubSections(nomsection)
{
var nomtf = "tf"; //nom des TextField
var nommc = "mcc"; //nom des MovieClip
var Longueur = 30; //largeur du nouveau champ texte
var Hauteur = 30; //hauteur du nouveau champ texte
for(i=0; i<sections[nomsection].length;i++) //tant qu'on atteint pas la fin du tableau
{
globale += i;
_root.createEmptyMovieClip(nommc+i,globale); //creation d'un nouveau MovieClip
x = eval(nommc+i); //variable egale au nom du Movieclip
x._x = 200 + i*30; //coordonnees en x
x._y = 20;//coordonnees en y
_root.x.createTextField(nomtf+i,i,x._x,x._y,Longueur,Hauteur); //creation d'un nouveuau textField
with (_root.x[nomtf+i])
{
text = sections[nomsection][i]; //texte a afficher
type = "dynamic"; //type du TextField
selectable = false; // empeche la selection
}
}
}
createButtonsSections(); //appel de la fonction
createButtonsSubSections("WELFARE"); |
Partager