Comunidad de diseño web y desarrollo en internet online

Traducir un simple codigo de AS2 a AS3

Citar            
MensajeEscrito el 08 Abr 2010 02:24 am
Buenas, gente de Cristalab :)

Como ando un poco perdido de AS3, me gustaría pedirles si me podrían "traducir" el siguiente codigo de AS2 a AS3, conservando las acciones que hace y si hace falta cambiando las funciones a usar, pero obteniendo el mismo resultado siempre (supongo que el behavior de BringtoFront estará desfasado, pero desconozco qué codigo de AS3 puede sustituirle ni qué sintaxis tiene).

Código ActionScript :

w1.onPress = function(){
startDrag(this, false);
   //Bring to Front Behavior
   mx.behaviors.DepthControl.bringToFront(w1);
   //End Behavior
} 

w1.onRelease = w1.onReleaseOutside = function(){
this.stopDrag()
}

w2.onPress = function(){
startDrag(this, false);
   //Bring to Front Behavior
   mx.behaviors.DepthControl.bringToFront(w2);
   //End Behavior
} 

w2.onRelease = w2.onReleaseOutside = function(){
this.stopDrag()
}


Gracias! :)

Por Mixalberto

25 de clabLevel



Genero:Masculino  

safari
Citar            
MensajeEscrito el 08 Abr 2010 01:33 pm
Bueno, ya lo conseguí ;)

Código ActionScript :

import flash.display.MovieClip;
import flash.events.MouseEvent;


w1.addEventListener(MouseEvent.MOUSE_DOWN, w1DOWN);
w1.addEventListener(MouseEvent.MOUSE_UP, w1UP);

function w1DOWN(evt:MouseEvent):void{
   var object = evt.target;
   object.startDrag();
   setChildIndex(w1,numChildren - 1);
}

function w1UP(evt:MouseEvent):void{
   var obj = evt.target;
   obj.stopDrag();
}

w2.addEventListener(MouseEvent.MOUSE_DOWN, w2DOWN);
w2.addEventListener(MouseEvent.MOUSE_UP, w2UP);

function w2DOWN(evt:MouseEvent):void{
   var object = evt.target;
   object.startDrag();
   setChildIndex(w2,numChildren - 1);
}

function w2UP(evt:MouseEvent):void{
   var obj = evt.target;
   obj.stopDrag();
}

Por Mixalberto

25 de clabLevel



Genero:Masculino  

safari

 

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