Comunidad de diseño web y desarrollo en internet online

Problema con menu

Citar            
MensajeEscrito el 16 Mar 2009 08:07 pm
Hola, tengo un problema en mi menu, tengo todos sus elementos en la linea de tiempo principal y el AS en el primer fotograma, hasta ahi todo funcion aperfectamente...

el problema empieza cuando los frames de los elementos asi como el frame del AS los meto en un MC (para efectos de liquid layout), todos los botones de dicho menu se pasman como si estuvieran en rollover...


ayudenme please...

este es el AS de todo el menu (en el frame):

Código :

function setActiveMenu()
{
    var _loc1 = _global;
    _loc1.mainChk = main;
    _loc1.subChk = sub;
    _loc1.subOver = 0;
} // End of the function
if (main == null || main == "" || main == undefined)
{
    main = 0;
} // end if
_global.mainChk = main;
_global.subChk = sub;
_global.subOver = 0;
var mainNum = 5;
var speed = 5;
for (i = 1; i <= mainNum; i++)
{
    _root["menu" + i].onRollOver = function ()
    {
        mName = new String(this._name);
        mNum = mName.substr(4, 2);
        _global.mainChk = mNum;
    };
    _root["menu" + i].onRollOut = function ()
    {
        _root.setActiveMenu();
    };
    _root["menu" + 1].onRelease = function ()
    {
        mName = new String(this._name);
        mNum = mName.substr(4, 2);
        _root.holder.gotoAndStop("home");
    };
    _root["menu" + 2].onRelease = function ()
    {
        mName = new String(this._name);
        mNum = mName.substr(4, 2);
       _root.holder.gotoAndStop("somos");
    };
   _root["menu" + 3].onRelease = function ()
    {
        mName = new String(this._name);
        mNum = mName.substr(4, 2);
        _root.holder.gotoAndStop("servicios");
    };   
   _root["menu" + 4].onRelease = function ()
    {
        mName = new String(this._name);
        mNum = mName.substr(4, 2);
        _root.holder.gotoAndStop("contacto");
    };
    _root["mtxt" + i].onEnterFrame = function ()
    {
        var _loc1 = this;
        mName = new String(_loc1._name);
        mNum = mName.substr(4, 2);
        if (_global.mainChk == mNum)
        {
            _loc1.nextFrame();
            return;
        } // end if
        _loc1.prevFrame();
    };
} // end of for
_root.slide.onEnterFrame = function ()
{
    var _loc1 = this;
    var _loc2 = _global;
    if (_loc2.mainChk != 0)
    {
        _loc1._x = _loc1._x + (_root["position" + _loc2.mainChk]._x - _loc1._x) / speed;
        return;
    } // end if
    _loc1._x = _loc1._x + (_root["position" + _loc2.mainChk]._x - _loc1._x) / speed;
};


este es el AS del primer boton de menu (dentro de el):

Código :

mainNum = 1;
subNum = 4;
for (i = 1; i <= subNum; i++)
{
    this["sb" + i].onRollOver = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _global.mainChk = mainNum;
        _global.subOver = sNum;
    };
    this["sb" + i].onRollOut = function ()
    {
        _parent.setActiveMenu();
    };
    this["sb" + i].onRelease = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        getURL("javascript:menu" + mainNum + "sub" + sNum + "();", "");
    };
    this["s" + i].onEnterFrame = function ()
    {
        var _loc1 = _global;
        var _loc2 = this;
        sName = new String(_loc2._name);
        sNum = sName.substr(1, 2);
        if (_parent.main == mainNum && _loc1.subChk == sNum && _loc1.subOver == 0)
        {
            _loc2.nextFrame();
            return;
        } // end if
        if (_loc1.subOver != sNum)
        {
            _loc2.prevFrame();
            return;
        } // end if
        if (_loc1.subOver == sNum)
        {
            _loc2.nextFrame();
        } // end if
    };
} // end of for
stop ();


que debo cambiar para que funcione dentro de un MC?

Gracias por su ayuda !!!!!!!!!!

Por tekman

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 17 Mar 2009 02:11 am
Si el codigo del AS en el frame, lo metes dentro de otro movieclip, no uses _root, usa this.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 20 Mar 2009 07:24 pm
que wey... recuerdo haber intentado eso pero yo creo que no lo cambie en todas partes donde aparecia.
quedó muy bien, pero que crees? cuando hago rollover en boton llega al fin de su animacion (hasta ahi bien) y cuando hago el rollout no regresa al punto inicial, a menos que haga rollover el otro boton.

esto tiene que ver con _global no??????

Por tekman

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Mar 2009 09:20 pm
cuando cambie el _root por this ya no funciona en fireFox !!!
alguien tiene alguna solucion?

Por tekman

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Mar 2009 11:46 pm
Bueno, te voy a decir que tu codigo esta todo raro, usas un for pero nisiquiera empleas su cualidades :S hay que practicar mas. Por eso no es recomendable usar global y _root, para que no tengas estos problemas. :S

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 21 Mar 2009 12:02 am

Código ActionScript :

function setActiveMenu( Void ):Void
{
    this.mainChk = main;
    this.subChk = sub;
    this.subOver = 0;
}

function goFotograma( aux:Number ):Void
{
   switch( aux )
   {
      case 1:
         _root.holder.gotoAndStop("home");
      break;
      case 2:
         _root.holder.gotoAndStop("somos");
      break;
      case 3:
         _root.holder.gotoAndStop("servicios");
      break;
      case 4:
         _root.holder.gotoAndStop("contacto");
      break;
   }
}

if (main == null || main == "" || main == undefined)
{
    main = 0;
}

var mainChk:Number = main;
var subChk:Number = sub;
var subOver:number = 0;
var mainNum = 5;
var speed = 5;

for ( var i:Number = 1; i <= mainNum; i++)
{
    this["menu" + i].index = i
    this["menu" + i].onRollOver = function ( Void )
    {
        this._parent.mainChk = this.index;
    };
    this["menu" + i].onRollOut = function ( Void )
    {
        this._parent.setActiveMenu();
    };
    this["menu" + i].onRelease = function ( Void )
    {
        this._parent.goFotograma( this.index );
    };
    this["mtxt" + i].index = i;
    this["mtxt" + i].onEnterFrame = function ( Void )
    {
        if ( this._parent.mainChk == this.index )
        {
            this.nextFrame();
        }
        else
        {
            this.prevFrame();
        }
    };
}

this.slide.onEnterFrame = function ( Void )
{
    var _loc2 = this._parent._parent;
    if ( _loc2.mainChk != 0 )
    {
        this._x += (_root["position" + _loc2.mainChk]._x - this._x) / speed;
    }
};


La verdad es que era un relajo el codigo.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 23 Mar 2009 08:35 am
Lo único que me causa problema es la linea roja:

Código :

[color=#888A85]var mainChk:Number = main; 
var subChk:Number = sub; [/color]
[color=#CC0000]var subOver:number = 0; [/color]
[color=#888A85]var mainNum = 4; 
var speed = 5; [/color]


me pasma otra vez los menus como si estuviera en rollover, si la quito jala bien pero... el submenu que tengo en el 3er menu ("mtxt3") aparece en rollover pero en cuanto salgo del area de este 3er boton para hacer rollover sobre los submenus ("sb1, sb2, sb3...") desaparecen el codigo de este submenu es el siguiente:

traté de moverle en la funcion de onRollOver pero no logre que permaneciera activo..

Código :

mainNum = 3;
subNum = 5;
for (i = 1; i <= subNum; i++)
{
    this["sb" + i].onRollOver = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _global.mainChk = mainNum;
        _global.subOver = sNum;
    };
    this["sb" + i].onRollOut = function ()
    {
        _parent.setActiveMenu();
    };
    this["sb" + 1].onRelease = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _parent._root.holder.gotoAndStop("3-1");
    };
    this["sb" + 2].onRelease = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _parent._root.holder.gotoAndStop("3-2");
    };
    this["sb" + 3].onRelease = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _parent._root.holder.gotoAndStop("3-3");
    };
    this["sb" + 4].onRelease = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _parent._root.holder.gotoAndStop("3-4");
    };
    this["sb" + 5].onRelease = function ()
    {
        sName = new String(this._name);
        sNum = sName.substr(2, 2);
        _parent._root.holder.gotoAndStop("3-5");
    };   
    this["s" + i].onEnterFrame = function ()
    {
        var _loc1 = _global;
        var _loc2 = this;
        sName = new String(_loc2._name);
        sNum = sName.substr(1, 2);
        if (_parent.main == mainNum && _loc1.subChk == sNum && _loc1.subOver == 0)
        {
            _loc2.nextFrame();
            return;
        } 
        if (_loc1.subOver != sNum)
        {
            _loc2.prevFrame();
            return;
        } 
        if (_loc1.subOver == sNum)
        {
            _loc2.nextFrame();
        } 
    };
}
stop ();


alguna sugerencia?

Por tekman

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 23 Mar 2009 08:36 am
Me refería a esta linea en rojo (la que causa error):

var mainChk:Number = main;
var subChk:Number = sub;

var subOver:number = 0;
var mainNum = 4;
var speed = 5;

Por tekman

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 23 Mar 2009 08:41 pm
EL ultimo codigo que posteas no se parece al que te pase yo.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 27 Mar 2009 09:20 pm
Hace falta mas codigo, el _global me parece que lo usas dentro de otras items. U_U tendria que verse el orgiinal
para ver porque uso el _global

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox

 

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