Comunidad de diseño web y desarrollo en internet online

Pasar AS1 a AS2

Citar            
MensajeEscrito el 11 Feb 2009 04:27 pm
Hola, ¿como están?

Tengo que pasar el siguiente script de AS1 a AS2 y no se como hacerlo. Si alguien me puede ayudar se lo voy a agradecer mucho.

Código :

setProperty ("selectorig", _visible, false);

newY = 10;

function InitMenu (ImTitle, ImMax) {
   for (i=0; i<IMMax; i++) {
      duplicateMovieClip ("selectorig", "select" add i, i);
      setProperty ("select" add i, _y, newY);
      
      set ("select" add i add ".selecttext", _root.menuselect[i]);
      setProperty ("select" add i, _visible, false);
      newY = newY+20;
   }
   Title = ImTitle;   
   Max = ImMax;      
}

function MakeVisible (SetOn) {
   for (i=0; i<Max; i++) {
      setProperty ("select" add i, _visible, SetOn);
   }
}


Muchas Gracias.

Andres.

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 04:33 pm
:? Los 2 son compatibles no necesitas cambiarlo, AS2 soporta AS1

solo tendías que definir los tipos de variables para que sea totalmente as2

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 11 Feb 2009 04:43 pm
Si, pero no logro que funcione, te muestro todo completo:

Código :

var menuselect = new array();


Código :

menuselect[0] = "Inicio";
menuselect[1] = "Clientes";
menuselect[2] = "Servicios";
//....
menuselect[12] = "Empresa";
menuselect[13] = "Contacto";
menu1.InitMenu("Menu",14);


Código :

setProperty ("selectorig", _visible, false);

newY = 10;

function InitMenu (ImTitle, ImMax) {
   for (i=0; i<IMMax; i++) {
      duplicateMovieClip ("selectorig", "select" add i, i);
      setProperty ("select" add i, _y, newY);
      
      set ("select" add i add ".selecttext", _root.menuselect[i]);
      setProperty ("select" add i, _visible, false);
      newY = newY+20;
   }
   Title = ImTitle;   
   Max = ImMax;      
}

function MakeVisible (SetOn) {
   for (i=0; i<Max; i++) {
      setProperty ("select" add i, _visible, SetOn);
   }
}


Código :

on (release) {
   ..:MakeVisible(false);
}


Andres.

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 04:44 pm
Hola:

Código ActionScript :

this["selectorig"]._visible = false;
//suponiendo que ImTitle es String.
function InitMenu ( ImTitle:String, ImMax:Number ):Void {
   var aux:MovieClip;
   for ( var i:Number = 0, newY:Number = 10; i < IMMax; i++, newY += 20 ) {
      aux = this.duplicateMovieClip( "selectorig", "select" + i, i );
      aux._y = newY;
      aux.selecttext = _root.menuselect[ i ];
      aux._visible = false;
   }
   Title = ImTitle;
   Max = ImMax;
}

function MakeVisible ( SetOn:Boolean ):Void {
   for ( var i:Number = 0; i < Max; i++ ) {
      this["select" + i]._visible = SetOn;
   }
}



Espero que sea lo que necesites. Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 11 Feb 2009 04:47 pm
¿que parte no funciona?

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 11 Feb 2009 04:55 pm

Código ActionScript :

setProperty ("selectorig", _visible, false);

newY = 10;

function InitMenu (ImTitle, ImMax) {
   for (i=0; i<ImMax; i++) {//aqui tenias IMMax 
      duplicateMovieClip ("selectorig", "select"+i, _root.getNextHighestDepth());
      setProperty ("select"+i, _y, newY);
      
      set ("select"+i+".selecttext", _root.menuselect[i]);
      setProperty ("select"+i, _visible, false);
      newY = newY+20;
   }
   Title = ImTitle;   
   Max = ImMax;      
}

function MakeVisible (SetOn) {
   for (i=0; i<Max; i++) {
      eval("select"+i)._visible= SetOn;
   }
}

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 11 Feb 2009 04:57 pm
la parte que no funciona bien es la que te mande primero, esta:

Código :

setProperty ("selectorig", _visible, false);

newY = 10;

function InitMenu (ImTitle, ImMax) {
   for (i=0; i<IMMax; i++) {
      duplicateMovieClip ("selectorig", "select" add i, i);
      setProperty ("select" add i, _y, newY);
      
      set ("select" add i add ".selecttext", _root.menuselect[i]);
      setProperty ("select" add i, _visible, false);
      newY = newY+20;
   }
   Title = ImTitle;   
   Max = ImMax;      
}

function MakeVisible (SetOn) {
   for (i=0; i<Max; i++) {
      setProperty ("select" add i, _visible, SetOn);
   }
}


Me tira el siguiente error:

**Error** Símbolo=Menux, capa=Action, fotograma=1, Línea 8: Se espera ')' o ','
duplicateMovieClip ("selectorig", "select" add i, i);

**Error** Símbolo=Menux, capa=Action, fotograma=1, Línea 9: Se espera ')' o ','
setProperty ("select" add i, _y, newY);

**Error** Símbolo=Menux, capa=Action, fotograma=1, Línea 11: Se espera ')' o ','
set ("select" add i add ".selecttext", _root.menuselect[i]);

Muchas Gracias por tu ayuda.

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 05:17 pm
La corrección anterior no funciona.

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 05:29 pm

Código ActionScript :

function InitMenu ( ImTitle, ImMax ){  
   for (i = 0; i < ImMax; i++) { 
      aux = this.duplicateMovieClip( "selectorig", "select" + i, i ); 
      aux._y = newY; 
      aux.selecttext = _root.menuselect[i]; 
      aux._visible = false; 
      newY+=20
   } 
   Title = ImTitle; 
   Max = ImMax; 
} 
 
function MakeVisible (SetOn) { 
   for (i = 0; i < Max; i++ ) { 
      this["select" + i]._visible = SetOn; 
   } 
} 

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 11 Feb 2009 05:35 pm
Corregido.

LongeVie escribió:

Hola:

Código ActionScript :

this["selectorig"]._visible = false;
//suponiendo que ImTitle es String.
function InitMenu ( ImTitle:String, ImMax:Number ):Void {
   var aux:MovieClip;
   for ( var i:Number = 0, newY:Number = 10; i < ImMax; i++, newY += 20 ) {
      aux = this.duplicateMovieClip( "selectorig", "select" + i, i );
      aux._y = newY;
      aux.selecttext = _root.menuselect[ i ];
      aux._visible = false;
   }
   Title = ImTitle;
   Max = ImMax;
}

function MakeVisible ( SetOn:Boolean ):Void {
   for ( var i:Number = 0; i < Max; i++ ) {
      this["select" + i]._visible = SetOn;
   }
}



Espero que sea lo que necesites. Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 11 Feb 2009 05:40 pm
Nacho: El script esta perfecto, no tira ningun error. Pero no lo puedo hacer funcionar.

Si tenes alguna idea avisame, sino seguire probando.

Muchas Gracias.

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 05:52 pm
La corrección que realizo “Nacho” no me tira errores pero no me funciona.
La corrección que realizo “LongeVie” me tira errores.

Les puedo pasar el archivo ".fla", como puedo hacer eso?

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 05:55 pm
:S tira errores.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 11 Feb 2009 06:01 pm
que quieres que haga el codigo?

según yo armas un array con todos los botones, después con la function InitMenu agregas todos los botones...

en ningun lado pones "_visible = true".. si puedes ver los botones?

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 11 Feb 2009 06:21 pm
ok, muchas gracias por la ayuda. ahora tengo que salir. mastarde me pongo de nuevo con esto.

Muchas Gracias.

Por a_fiore_01

9 de clabLevel



 

msie7
Citar            
MensajeEscrito el 11 Feb 2009 11:46 pm
Atención, sospecho de NPI grave y peligro de post a varias páginas. Ver duplicado en http://foros.cristalab.com/de-flash-5-a-flash-cs3-t68518/

Jorge

Longevie: me parece muy bondadoso de tu parte habérselo traducido sin mediar palabra, pero recuerdo siempre medir tu esfuerzo y dárselo a quien pueda aprovecharlo

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 12 Feb 2009 12:03 am
U_U es cierto solisarg.

Por cierto, mi correcion no tira errores, almenos no errores de sintaxis. y estoy con Nacho, estoy seguro que le ha faltado el _visible = true.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 12 Feb 2009 03:03 pm
Amigos, gracias pero ese script no lo pude hacer funcionar. Arme otro parecido pero le cambie algunos valores y lo pude hacer funcionar.

Disculpen que duplique el post, pero necesitaba ayuda y gracias a ustedes pude lograr lo que estaba armando.

Muchas Gracias.

Por a_fiore_01

9 de clabLevel



 

msie7

 

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