Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

DanilloSG

Converter ActionScript2 para ActionScript3

Recommended Posts

Oi Galera, tudo bom?!

 

Estou tendo um probleminha... pois tenho um background q está com o ActionScript 2.0 mas no site em flash q tento carregar ele não consigo, na documentação do site diz que o site só aceita em AS3.

 

Alguém poderia me ajudar na conversão do código, porque de ActionScript não manjo nada =/

 

Segue o código abaixo:

 

Stage.scaleMode = "noScale";
Stage.align = "TL";
//
grad._x = 0;
grad._y = 0;
grad._width = Stage.width;
grad._height = Stage.height;
textureGrad_mc._width = Stage.width;
textureGrad_mc._height = Stage.height;
//
var stageListener:Object = new Object ();
stageListener.onResize = function () {
	grad._x = 0;
	grad._y = 0;
	grad._width = Stage.width;
	grad._height = Stage.height;
	textureGrad_mc._width = Stage.width;
	textureGrad_mc._height = Stage.height;
};
Stage.addListener (stageListener);//-------------------------------------------------------------------------------------------------------
//define number of layer.
var layer = 10;
//number of items in a layer
var items = 50;
//create the bg that holds the layers
this.createEmptyMovieClip ("bgHolder",this.getNextHighestDepth ());
//this function will update the layers current position
function updateMovies () {
	//easingStrenth
	easing = 30;
	this.x = _root._xmouse;
	this.y = _root._ymouse;
	//get the linear relation fo x.
	var linearRelation = (Stage.width - this._width) / Stage.width;
	//update x with easing.
	this._x -= (this._x - linearRelation * this.x) / easing;
	//get the linear relation fo y.
	linearRelation = (Stage.height - this._height) / Stage.height;
	//update y with easing.
	this._y -= (this._y - linearRelation * this.y) / easing;
}
//init function for the layers
function init () {
	for (i = 0; i < layer; i++) {
		//create a layer
		temp = this.bgHolder.createEmptyMovieClip ("bg" + i, this.bgHolder.getNextHighestDepth ());
		depth = temp.getNextHighestDepth ();

		//put the items into the layer
		for (j = 0; j < items; j++) {
			depth = temp.getNextHighestDepth ();
			//attach an item
			tempN = temp.attachMovie ("icon", "icon" + depth, depth);
			//
			if (i < 5) {
				if (i == 0) {
					ZigoEngine.doTween (tempN,'Blur_blurX, Blur_blurY',[10, 10],2,"easeOutExpo");
				}
				else {
					ZigoEngine.doTween (tempN,'Blur_blurX, Blur_blurY',[5 / i, 5 / i],2,"easeOutExpo");
				}
			}
			//position it randomly in the current layer    
			tempN._x = Math.random () * (i + 2) * Stage.width;
			tempN._y = Math.random () * (i + 2) * Stage.height;
			//scale it randomly
			rand = Math.random ();
			tempN._xscale *= .2 + rand;
			tempN._yscale *= .2 + rand;
			//put is opacity randomly
			tempN._alpha = random (80) + 20;
		}
		//each layer share the same updating function.
		temp.onEnterFrame = this.updateMovies;
	}
}
init ();

Ficaria muito agradecido se aalguém pudesse me ajudar =D

 

Desde já agradeço pessoal.

 

Fiquem com Deus! =)

Compartilhar este post


Link para o post
Compartilhar em outros sites

converter todo esse código, vai ser difícil alguém aqui fazer ...

 

 

o ideal é você começar a fazer, linha por linha, e se travar em algum ponto, poste aqui de novo

 

 

 

[]´s

Compartilhar este post


Link para o post
Compartilhar em outros sites

converter todo esse código, vai ser difícil alguém aqui fazer ...

 

 

o ideal é você começar a fazer, linha por linha, e se travar em algum ponto, poste aqui de novo

 

 

 

[]´s

 

Hummmm... Eu pensei q fosse fácil hehehehe é porque não entendo de ActionScript.. aí nem sei como fazer essa conversão... tem algum tutorial explicando de maneira bem fácil de entender? rsrsrs

Porque já procurei na web e não achei nada bem objetivo...

 

Tentei fazer por um conversor online neste endereço http://www.5etdemi.com/convert mas soh q o código gerado não rodou... quando testava não acontecia nada.. =/

 

O código q o conversor retornou foi...

 

package  { 
	Stage.scaleMode = "noScale";
	import flash.display.MovieClip;
	import flash.display.Stage;
	stage.align = "TL";
	//
	grad.x = 0;
	grad.y = 0;
	grad.width = stage.stageWidth;
	grad.height = stage.stageHeight;
	textureGrad_mc.width = stage.stageWidth;
	textureGrad_mc.height = stage.stageHeight;
	//
	var stageListener:Object = new Object ();
	stageListener.onresize = function () {
	        grad.x = 0;
	        grad.y = 0;
	        grad.width = stage.stageWidth;
	        grad.height = stage.stageHeight;
	        textureGrad_mc.width = stage.stageWidth;
	        textureGrad_mc.height = stage.stageHeight;
	};
	Stage.addListener (stageListener);//-------------------------------------------------------------------------------------------------------
	//define number of layer.
	var layer = 10;
	//number of items in a layer
	var items = 50;
	//create the bg that holds the layers
	this.createEmptyMovieClip ("bgHolder",this.getNextHighestDepth ());
	//this function will update the layers current position
	function updateMovies () {
	        //easingStrenth
	        easing = 30;
	        this.x = _root.mouseX;
	        this.y = _root.mouseY;
	        //get the linear relation fo x.
	        public var linearRelation = (stage.stageWidth - this.width) / stage.stageWidth;
	        //update x with easing.
	        this.x -= (this.x - linearRelation * this.x) / easing;
	        //get the linear relation fo y.
	        linearRelation = (stage.stageHeight - this.height) / stage.stageHeight;
	        //update y with easing.
	        this.y -= (this.y - linearRelation * this.y) / easing;
	}
	//init function for the layers
	function init () {
	        for (i = 0; i < layer; i++) {
	                //create a layer
	                temp = this.bgHolder.createEmptyMovieClip ("bg" + i, this.bgHolder.getNextHighestDepth ());
	                depth = temp.getNextHighestDepth ();
	
	                //put the items into the layer
	                for (j = 0; j < items; j++) {
	                        depth = temp.getNextHighestDepth ();
	                        //attach an item
	                        tempN = temp.attachMovie ("icon", "icon" + depth, depth);
	                        //
	                        if (i < 5) {
	                                if (i == 0) {
	                                        ZigoEngine.doTween (tempN,'Blur_blurX, Blur_blurY',[10, 10],2,"easeOutExpo");
	                                }
	                                else {
	                                        ZigoEngine.doTween (tempN,'Blur_blurX, Blur_blurY',[5 / i, 5 / i],2,"easeOutExpo");
	                                }
	                        }
	                        //position it randomly in the current layer    
	                        tempN.x = Math.random () * (i + 2) * stage.stageWidth;
	                        tempN.y = Math.random () * (i + 2) * stage.stageHeight;
	                        //scale it randomly
	                        rand = Math.random ();
	                        tempN.scaleX *= .2 + rand;
	                        tempN.scaleY *= .2 + rand;
	                        //put is opacity randomly
	                        tempN.alpha = random (80) + 20;
	                }
	                //each layer share the same updating function.
	                temp.onEnterFrame = this.updateMovies;
	        }
	}
	init ();
}

Compartilhar este post


Link para o post
Compartilhar em outros sites

ola,

foi criado um pacote e isso tem q ser usado externamente.

crie um actionscript file.

e inclua no palco desejado.

qualquer coisa faz uma pesquisa sobre integração de pacotes.

abraço.

 

 

Ali foi o que o conversor retornou, no caso não precisa ter pacakage se o código está no primeiro frame, visto que não temos uma declaração de classe.

 

O problema mesmo é como o Eder citou é dificil alguem ter tempo e boa vontade de migrar esse bloco de código.Seria mais fácil você ir tentando aos poucos dividir pra conquistar.

 

Abs

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.