Results 1 to 5 of 5

Thread: How to convert Actionscript 2 to actionscript 3

  1. #1
    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?

  2. #2
    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

  3. #3
    Join Date
    May 2009
    Posts
    539

    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

  4. #4
    Join Date
    May 2009
    Posts
    511

    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 
    }

  5. #5
    Join Date
    Apr 2009
    Posts
    569

    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 ; 
    }

Similar Threads

  1. Flash ActionScript loops
    By Aman 1 in forum Software Development
    Replies: 3
    Last Post: 15-12-2009, 08:06 AM
  2. ActionScript 3 beginner having problem
    By MADGE25 in forum Software Development
    Replies: 4
    Last Post: 18-11-2009, 05:41 PM
  3. Want to learn ActionScript.....What to Refer?
    By Andrzej in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 12:12 PM
  4. ActionScript in Flash CS3
    By Manthan in forum Software Development
    Replies: 4
    Last Post: 08-07-2009, 10:18 PM
  5. Actionscript 3 Compiler ?
    By Xavier1234 in forum Software Development
    Replies: 3
    Last Post: 29-06-2009, 05:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,619,715.73798 seconds with 17 queries