Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 16-01-2011
Member
 
Join Date: Jan 2011
Posts: 27
How to convert Actionscript 2 to actionscript 3

I am developing a flash website by utilizing the free template from one of my favorite website, This website is all about the solar system to teach kids. Now I have collected some of the flash movies from the national geographic website which I want to put on my favorite website. Now the problem is when I am opening an editor of that website, As soon as I add those flash video it prompts me saying that the "This file uses Actionscript 2, please convert to Actionscript 3 and upload again." Can somebody tell me that how can I convert Actionscript 2 into Actionscript 3?
Reply With Quote
  #2  
Old 16-01-2011
Member
 
Join Date: Jan 2011
Posts: 42
Re: How to convert Actionscript 2 to actionscript 3

Now my question is simple, I want to convert a code As2 into As3...could anyone help me?

Code:
Stage.align = "LT"; 
Stage.scaleMode = "noScale"; 

listenerObject var: Object = new Object (); 
listenerObject. onResize = function (Void) {Void 
reposionner (); 
} 

reposionner function () { 
text. _x = (Stage.width / 2) - (text. _width / 2) 
text. _y = (Stage.height / 2) - (text. _height / 2); 
} 
Stage.addListener (listenerObject);
So is a code that allows me to have my flash that takes all the space in a browser and have an element that automatically repositions itself at the center of the navigation area. I am a shit As3 and it is something quite urgent for me to come ask for your help. Someone would it be how to convert this code in AS3 or give me references to make exactly the same thing with a brand-new code in As3?

Thank you in advance
Reply With Quote
  #3  
Old 16-01-2011
Member
 
Join Date: May 2009
Posts: 532
Re: How to convert Actionscript 2 to actionscript 3

You have rightly pointed out the principle of the Event (new in AS3) already present in AS2 and in the example you gave. So in AS3 it is no longer necessary to create an object that will be used as a listener, but suffice to say to an object (any) listen to an event. So I'll give you a hint, and to prove to me that you were able to understand (to give you the ready solution was too easy), you'll give me your code with the solution I'll explain. To create an event listener, simply do as follows:

Code:
ObjectAEcouter.addEventListener (Event.EvenementAEcouter, FonctionADeclencher); 
FonctionADeclencher function (evt: Event): void {/ / event is an "alias" referring to the listener that triggered the function 
}
Theoretically, with it you better draw. So I'm waiting for your self-modified code
Reply With Quote
  #4  
Old 16-01-2011
Member
 
Join Date: May 2009
Posts: 503
Re: How to convert Actionscript 2 to actionscript 3

Here I have provided the code for the Actionscript 3 as follows. You can grasp whatever is needed for your script to convert it from AS2 to AS3. But make sure that this is not the code that automatically converts the AS2 to AS3.

Code:
Stage.scaleMode = StageScaleMode.NO_SCALE; 
Stage.align = StageAlign.TOP_LEFT; 
stage.addEventListener (Event.RESIZE, __onStageResized) 

__onStageResized function (event: Event): void 
{ 
var w: int = stage.stageWidth, h: int = stage.stageHeight; 
/ / Resizes here or replace your items according to the new size of the course 
}
Reply With Quote
  #5  
Old 17-01-2011
Member
 
Join Date: Apr 2009
Posts: 567
Re: How to convert Actionscript 2 to actionscript 3

Only in AS3, there are the properties _y, _height not. The hot now only y or height. (As far as I can remember)
Code:
runter_btn . addEventListener ( MouseEvent . CLICK , fun_runter ); 
function fun_runter ( event : MouseEvent ): void { 
if( dein_mc . y > maske . height - dein_mc . height ) 
dein_mc . y = dein_mc . y - 10 ; 
} 

hoch_btn . addEventListener ( MouseEvent . CLICK , fun_hoch ); 
function fun_hoch ( event : MouseEvent ): void { 
if( dein_mc . y <= maske . y ) 
dein_mc . y = dein_mc . y + 10 ; 
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to convert Actionscript 2 to actionscript 3"
Thread Thread Starter Forum Replies Last Post
Flash ActionScript loops Aman 1 Software Development 3 15-12-2009 08:06 AM
ActionScript 3 beginner having problem MADGE25 Software Development 4 18-11-2009 05:41 PM
Want to learn ActionScript.....What to Refer? Andrzej Software Development 3 14-11-2009 12:12 PM
ActionScript in Flash CS3 Manthan Software Development 4 08-07-2009 10:18 PM
Actionscript 3 Compiler ? Xavier1234 Software Development 3 29-06-2009 05:09 PM


All times are GMT +5.5. The time now is 12:55 AM.