Comunidad de diseño web y desarrollo en internet online

menu con actionscript

Citar            
MensajeEscrito el 07 Ago 2007 10:56 am
hola,

he realizado un menu, siguiendo un ejemplo de la web, con un "efecto de persiana". Se trata de un menu vertical que al clickar en alguna barra, las inferiores se desplazan hacia abajo y aparecen los submenus de la barra clickada.

el flash esta hecho con action script, es un mc que genera los menus y submenus segun las acciones que escribes en el primer frame:

Código :

//to be replaced by extrenal text file.
//menu items
total = 11;
text1 = "home";
text2 = "dogs";
text3 = "cats";
text4 = "rabbits";
text5 = "hamsters";
text6 = "rats";
text7 = "mice";
text8 = "guinea pigs";
text9 = "ferrets";
text10 = "chinchillas";
text11 = "monkeys";

//submenus
subText2 = 2;
stext21 = "puppies";
stext22 = "adult";

subText4 = 2;
stext41 = "short hair";
stext42 = "long hair";

stop();


dentro de ese mc, el primer frame aparece el codigo que genera el menu:

Código :

//initialize main menu
for (i=1; i<=_root.total; ++i) {
   //duplicate movie clip
   menuMC.duplicateMovieClip("menuMC"+i, i);
   //set new position
   this["menuMC"+i]._y = this["menuMC"+(i-1)]._y+this["menuMC"+(i-1)]._height;
   this["menuMC"+i].choice = i;
   //create a variable to record the levels of the created MCs
   levelTrack = i;
}
//initialize submenu by creating and positioning movie clips
for (i=1; i<=_root.total; ++i) {
   //check to see if the item has a submenu
   if (_root["subText"+i]>=1) {
      name = "stext"+i;
      for (n=1; n<=_root["subText"+i]; ++n) {
         levelTrack += 1;
         subMenuMC.duplicateMovieClip(name+n, levelTrack);
         this[name+n]._visible = false;
         this[name+n].choice = (i*10) + n;
      }
      //position first submenu item under parent
      this[name+1]._y = this["menuMC"+i]._y+this["menuMC"+i]._height;
      //position rest of submenu items
      for (n=2; n<=_root["subText"+i]; ++n) {
         this[name+n]._y = this[name+(n-1)]._y+this[name+(n-1)]._height;
      }
   }
}

//hide all the submenu items and return the main menu items to their start position
function resetMenu() {
   for (i=1; i<=_root.total; ++i) {
      if (_root["subText"+i]>=1) {
         name = "stext"+i;
         for (n=1; n<=_root["subText"+i]; ++n) {
            this[name+n]._visible = false;
         }
      }
      this["menuMC"+i]._y = this["menuMC"+(i-1)]._y+this["menuMC"+(i-1)]._height;
   }
}
// called by clicking themain menu buttons, this shows the submenu andmoves the main menu buttons to give them space
function submenuShow() {
    resetMenu();
   if (_root["subText"+choice]>=1) {
      name = "stext"+choice;
      for (n=1; n<=_root["subText"+choice]; ++n) {
         this[name+n]._visible = true;
      }
      this["menuMC"+(choice+1)]._y = this[name+(n-1)]._y+this[name+(n-1)]._height;
      for (i=choice+2; i<=_root.total; ++i) {
         this["menuMC"+i]._y = this["menuMC"+(i-1)]._y+this["menuMC"+(i-1)]._height;
      }
   }
}


y contiene 2 mc: uno el boton del menu generico y el otro el boton del submenu generico.
etc... etc... etc...

Yo quisiera saber como debo hacer ahora para añadirle los links a los botones del menu, imagino que sera por actionscript, pero me he perdido y no conozco bien el medio. Supongo que ira en el primer frame de todos donde se especifica la cantidad y el texto de los menus y submenus, pero no se exactamente como. :crap:

Alguien me puede ayudar? no se por donde seguir, os necesito caballeros del flash!

muchisimas gracias

Por FactionStrip

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 29 Sep 2008 05:25 pm
yo tambien tengo el mismo prioblema
tienes alguna solucion????????? estoy con esto hace dias :shock:

Por web_

11 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.