Comunidad de diseño web y desarrollo en internet online

Xml menu, carga swf...

Citar            
MensajeEscrito el 22 Ene 2008 05:24 pm
Tengo este codigo que es de un menu xml. Pero no quiero que me cargue una URL si no que me cargue un swf dentro de la pelicula en algun nivel. No se como hacer eso, por eso me dirijo a ustedes para que me ayuden.

Código :

// Here the array object is created.
var manuel:Array = new Array();

// Here the XML object is created.
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
   
// De data from the xml is loaded into flash
// Using a 'for' loop the data is placed inside the array
   if (success) {
      menuItems = this.firstChild;
      for (i=0; i<menuItems.childNodes.length; i++) {
         manuelen = menuItems.childNodes[i];
         manuel.push(manuelen);
      }
      
   }
// As soon as the data is loaded int the array the function below will be executed
   attachMenu();
};
myXML.load("xml/menu.xml");

// This function attaches the menn buttons to the stage with the right data
function attachMenu() {
   for (i=0; i<manuel.length; i++) {
      
      var menuItems = menuHolder.attachMovie("button", "button"+i, 10000+i);
      menuItems._x = menuItems._x+(menuItems._width+margin)*i;
      if(pag.toLowerCase(pag) == manuel[i].attributes.naam.toLowerCase()) {
         menuItems.knopContent.gotoAndStop("over");
      }
      
      menuItems._href = manuel[i].attributes.href;
      menuItems.contentT = manuel[i].attributes.naam;
      menuItems.textobotones.text = manuel[i].attributes.naam;
      
      // The events when you roll over the button
      menuItems.onRollOver = function():Void {
         this.gotoAndStop(2);
      }
      // The events when you roll off the button
      menuItems.onRollOut = function():Void {
         this.gotoAndPlay(3);
      }
      // The events when you click the button
      menuItems.onRelease = function():Void {
         getURL(this._href, "_self");
      }
   }
};


Tambien me gustaria que se pudiera hacer lo siguiente cuando, cliqueara algun boton en el menu, este se moviera hacia la derecha unos 1000 px. Y no se si se puede que cuando cliquee en un boton este quede marcado indicando en que seccion estoy. :lol: que pena por preguntar tanto.

Mil gracias por la ayuda :oops:

Por boruga

21 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Ene 2008 05:53 pm
mira al final del codigo tienes esta linea:

Código :

 menuItems.onRelease = function():Void {
         getURL(this._href, "_self");// borras esto y pones lo que necesitas que haga
      }

entonces quedaría algo asi:

Código :

 menuItems.onRelease = function():Void {
}

Lo de los 1000px no se como funcionaría porque el boton ya no se vería en la pantalla (me imagino) pero igual. Y para que quede marcado le puedes agregar esto:

Código :

menuItems.onRelease = function():Void  {
   for (var j:Number = 1;j<=manuel.length;j++) {
      var clip:MovieClip = eval();
      clip.enabled = true;
      clip._alpha = 100;
   }
   this.enabled = false;
   this._alpha = 50;// este valor lo puedes cambiar por el que más te parezca
};

Por vcomics

217 de clabLevel



 

Medellin - Colombia

firefox
Citar            
MensajeEscrito el 22 Ene 2008 07:11 pm
No me funciona dice que tengo un error en

Código :

var clip:MovieClip = eval();


y si me pudieras esplicar que tengo que poner para que funcione la carga de swf, pues como seria el codigo para que esto ocurriera te lo agradeceria, aqui tendria que cargas unos cuantos en un nivel inferior, el menu xml lo estoy cargando en un nivel 5 y abajo no tengo nada, pero los swf se cargarian abajo. Gracias

Código :

menuItems.onRelease = function():Void  {
   for (var j:Number = 1;j<=manuel.length;j++) {
      var clip:MovieClip = eval();
      clip.enabled = true;
      clip._alpha = 100;
   }
   this.enabled = false;
   this._alpha = 50;// este valor lo puedes cambiar por el que más te parezca
};
[/quote][/code]

Por boruga

21 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Ene 2008 08:01 pm
:shock: Jejeje se me olvidó decirte esa parte
debes poner el nombre generico de los botones sin el numero

Código :

var clip:MovieClip = eval("button"+i);

^^

Por vcomics

217 de clabLevel



 

Medellin - Colombia

firefox
Citar            
MensajeEscrito el 22 Ene 2008 08:02 pm

vcomics escribió:

:shock: Jejeje se me olvidó decirte esa parte
debes poner el nombre generico de los botones sin el numero

Código :

var clip:MovieClip = eval("button"+i);

^^

no es "i" sino "j"

Código :

var clip:MovieClip = eval("button"+j);

Ahora si está bien!!
:wink:

Por vcomics

217 de clabLevel



 

Medellin - Colombia

firefox

 

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