Comunidad de diseño web y desarrollo en internet online

Como traducir este codigo AS2 a AS3?

Citar            
MensajeEscrito el 04 Sep 2012 12:11 am

Código ActionScript :

//Action Script 2.0
stop();
starttime = getTimer();

MovieClip.prototype.easeTimelineTo = function(finalFrame,power){
        if(power==undefined){ power=6 };
        var rounding; finalFrame>barra_mc._currentframe ? rounding="ceil" : rounding="floor";
        barra_mc.createEmptyMovieClip("easeTimeline_mc",4).onEnterFrame = function(){
                barra_mc._parent.gotoAndStop( barra_mc._parent._currentframe + Math[rounding]((finalFrame-barra_mc._parent._currentframe)/power) );
                if(barra_mc._parent._currentframe==finalFrame){ barra_mc.removeMovieClip() };
        }
}

barra_mc.onEnterFrame = function(){
   
   total = _root.getBytesTotal()/1000;
   received = _root.getBytesLoaded()/1000;
   bar_perc = (received/total)*300;
   txt_perc = (received/total)*100;
   
//Establece el tiempo de Easing:
      var ease = 6;
      
   barra_mc.gotoAndStop( barra_mc._currentframe + Math.ceil((bar_perc-barra_mc._currentframe)/ease) );
   barra_mc.porc.text = int(txt_perc) + "%";
   
        if(txt_perc==100 && barra_mc._currentframe==300){
                play();
                delete barra_mc.onEnterFrame;
        }
}



logre hacer esto.... pero no funciona nada...

Código ActionScript :

//Action Script 3.0
stop();
var starttime:Number = getTimer();

var nmc:MovieClip = new MovieClip();
nmc.name = "easeTimeline_mc",4;


MovieClip.prototype.easeTimelineTo = function(finalFrame,power){
        if(power==undefined){ power=6 };
        var rounding; finalFrame>barra_mc.currentFrame ? rounding="ceil" : rounding="floor";
        barra_mc.addChild(nmc).addEventListener(Event.ENTER_FRAME, ef);
      function ef(e:Event):void {
                barra_mc.MovieClip(parent).gotoAndStop( barra_mc.MovieClip(parent).currentFrame + Math[rounding]((finalFrame-barra_mc.MovieClip(parent).currentFrame)/power) );
                if(barra_mc.MovieClip(parent).currentFrame==finalFrame){ barra_mc.removeChild(nmc) };
        }
}

import flash.display.*;
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, preloader);
function preloader(event:ProgressEvent):void {

    var total:Number = event.bytesTotal/1000;
    var received:Number = event.bytesLoaded/1000
   var bar_perc:Number = (received/total)*300;
   var txt_perc:Number = (received/total)*100;
   
        var ease = 6;
      
    barra_mc.gotoAndStop( barra_mc.currentFrame + Math.ceil((bar_perc-barra_mc.currentFrame)/ease) );
    barra_mc.porc.text = int(txt_perc) + "%";
   
        if(txt_perc==100 && barra_mc.currentFrame==300){
                play();
                delete barra_mc.onEnterFrame;
        }
}


Alguien sabe como hacerlo? GRACIAS DE ANTEMANO...

Por soloelroy

13 de clabLevel



 

chrome
Citar            
MensajeEscrito el 04 Sep 2012 12:18 pm
El prototype ya no se usa en AS3, igual si quieres hacer un preloader, hay cantidad ya hecho en AS3. Si quieres hacer algo específico, cuenta que es, traducir AS2 a AS3 es como hacer la tarea de la escuela, a nadie le gusta :)

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 04 Sep 2012 09:40 pm
Jajaja no me habia puesto a pensar de esa manera xD intentare cambiar el prototype... pero que podria usar en lugar? Esque es un preloader que aplica Easing a la linea de tiempo :S

Por soloelroy

13 de clabLevel



 

chrome

 

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