Converting AS2 to AS3?  Can it be done?

Hi,
First I'm not a Flash developer, I'm asking this question to help another group trouble shoot a problem. While I know this sounds dumb, I need an official answer to they can close this solution as some type of an option to solve this problem.
I was given several swfs from an elearning course in hopes that they could someone be put into Captivate and wrapped for an LMS.  Apparently the Flash developer isn't able to code these files for the LMS (weird yes, but not my task in this problem)  In looking at the swfs I was given they all say they were created using AS2 and of course, Captivate only supports AS3. 
Short of redoing the Flash files in AS3 is there any other way to take something written Flash using AS2 and output it to a swf that is AS3?
Thanks for indulging me with your time.

You cannot "Convert" an as2.swf to an as3.swf.
You would need to have the original .fla file that created the as2.swf and manually export it to as3.
The actionScript may need converting depending on several things. Hard to give an exact answer.
An example of something needing conversion would be as something simple as a something referenced in a function may be doing something like...
_parent.movieClipName._visible = true ;
needs to be changed to
parent.movieClipName.visible = true;
because the underscore needed in certain name references was removed in AS3.
There are too many things that could need changing to name them all.
Another approach that "may" work as a creative workaround (hack) ...
You could create a new as3.fla and export a new as3.swf that can actually
load the original as2.swf file into the new as3.swf
Then just load the new as3.swf into Captivate.
Here is a link that will help and there is an example available to download
http://www.kirupa.com/forum/showthread.php?295698-loading-an-AS2-swf-into-an-AS3-swf
HTH

Similar Messages

  • Help Converting AS2 to AS3 Drag and Drop Event

    Hi All,
    This is the second post on help for converting AS2 to AS3. This code is used in Captivate to allow a drag and drop action between two areas (User presses down, drags, and releases in a second area - They are not dragging any object). If anyone can help me convert this please let me know.
    Source for Drag and Drop: (Note: Single MovieClip)
    // pause the Captivate movie
    _root.rdcmndPause = 1;
    // when the user's mouse is let go check if there was a successful drop
    _root.onMouseUp = function(){
              // If the source area's center coordinate is nearby the destination area's center coordinate then advance the slide
              if ( Math.abs(_root.sourceX + _root.sourceWidth  / 2 + _root.sourceParentX - (_root.destX + _root.destWidth  / 2)) < (_root.destWidth  / 2) &&
                         Math.abs(_root.sourceY + _root.sourceHeight / 2 + _root.sourceParentY - (_root.destY + _root.destHeight / 2)) < (_root.destHeight / 2) )
                        _root.rdcmndNextSlide = 1;
              } else {
                        // show error movie clip for 2 seconds (60 frames at 30 frames per second)
                        _root.showErrorMessage = 60;
      mc.onEnterFrame = function(){
              // continuously update the source area's coordinates and size
              _root.sourceX = mc._x;
              _root.sourceY = mc._y;
              _root.sourceWidth = mc._width;
              _root.sourceHeight = mc._height;
              _root.sourceParentX = _parent._x;
              _root.sourceParentY = _parent._y;
    mc.onPress = function(){
              // Uncomment following line to have control click capabilities
              //if(key.isDown(Key.CONTROL))
              // when user clicks on the source area click start the drag
                        startDrag(this);
    mc.onRelease = function(){
              // stop drag when user releases the source area
              stopDrag();
    Source for Destination Area (Single MovieClip named destArea)
    // Set a root variable to control when the error message is displayed
    _root.showErrorMessage = -1;
    // Use setCoords variable so we only set the destination coordinates once
    var setCoords = 0;
    destArea.onEnterFrame = function(){
              if (setCoords == 0){
                        // set the destination x, y, width, and height
                        _root.destX = _parent._x;
                        _root.destY = _parent._y;
                        _root.destWidth = _parent._width;
                        _root.destHeight = _parent._height;
              // destination coordinates have been set, change setCoords so it doesn't get set again
              setCoords = 1;
    Code for the Error Message (Single MovieClip named errorMessage)
    // Don't display the error message initially
    errorMessage._alpha = 0;
    errorMessage.onEnterFrame = function (){
              // If the drag and drop method detects a missed drop
              // then show this error message by setting _alpha to 100
              if (_root.showErrorMessage > 0){
                        errorMessage._alpha = 100;
                        // decrementing this variable controls the time the
                        // error message will be displayed
                        _root.showErrorMessage--;
              } else {
                        // Don't display the error message
                        errorMessage._alpha = 0;

    use:
    MovieClip(parent.parent.parent).rdcmndPause=1;
    this.addEventListener(KeyboardEvent.KEY_DOWN,keydownF);
    function keydownF(e:KeyboardEvent):void{
    fscommand("KEYPRESSED", e.keyCode);
    if(e.keyCode==32){
    MovieClip(parent.parent.parent).rdcmndNextSlide=1;

  • Convert AS2 To AS3

    So I made this basic game a few years ago which was in AS2 and Flash 6.  Now I want to convert this game from AS2 to AS3 but I have no idea where to start.  The code is approximalty 4k lines long and I don't know what to change to make it work in AS3.  What do you guys suggest?

    Are you using external .as files and classes or are you using frame scripts directly in the timeline? Are you used to any other object oriented programming languages? Knowing more about other languages you might know would help a lot.
    AS2 very informal and specialized to Flash. It relates to pretty much no other language out there, like JavaScript seldom relates. They're c-esque but only in a very distant 3rd cousin style.
    AS3 is much more OOP oriented and typed versus the less formal, error-prone loose dynamic nature of AS2. While your game would benefit greatly from the speed increases and error reduction, I think you're really swinging for the fence on this one. While some classes may resemble their AS2 counterpart and the core global functions work the same, everything else is different. Starting off trying to convert 4,000 lines of code is a little steep.
    As mentioned, the resources to learn AS3 are excessive and plentiful from video training to tutorials to the API reference itself. Google has it all.
    I think you really should lower your target and just try some really simple, basic things. Draw a shape, add a listener, do something basic when clicked, etc. You'll get a good idea of how different things are with the new display list rather than tearing your hair out converting your as2 game.

  • How to convert AS2 to AS3

    Hi I am new to flash AS3. I have a program in AS2 and wants to convert it in AS3. I change the settings from File->Publish Settings. and selected "Flash player 9 and Action Script 3" and after that I am getting some error message and WARNING
    WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.
    WARNING: Text field variable names are not supported in ActionScript 3.0. The variable 'NumResults' used for an unnamed text field will not be exported.
    Please suggest me how do I resolve this WARNINGs.

    You are likely to find those are just a few top level errors/warnings you'll get when you try to turn an AS2 file directly into an AS3 file.  There's probably a long line of others regarding syntax and properties that will pop up once you start trying to compile the file.
    AS3 does not allow code to be attached to objects like earlier versions of AS did, so you need to find each object (usually buttons) that has code attached to it, give instance names to those objects, and create that code as event listener/handler pairs.
    AS3 does not allow textfields to carry vars as identifiers, so again you need to assign instance names to the textfields and use the "text" property to assign or read String values to/from them.  So if you have variables that relate to textfield values, then those variables have to be equated to the text property of the textfields... var textVar = text_field.text   OR  text_field.text = textVar

  • Please need help converting AS2 to AS3 code

    Hi, I want to convert an AS2 code to AS3. Someone can tell
    what is wrong. (it is about a speed effect) - Thanks a lot.
    mport flash.filters.BlurFilter;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var duration:Number = 15;
    var t1:Tween = new Tween(mcToTween1, "_x", Elastic.easeIn,
    133, 367, duration, 0);
    var t2:Tween = new Tween(mcToTween1, "blur", Elastic.easeIn,
    0, 0, 1, true);
    t1.onMotionChanged = function() {
    oldx = x;
    oldy = y;
    x = mcToTween1._x;
    y = mcToTween1._y;
    speedx = Math.round(Math.abs((x-oldx)));
    speedy = Math.round(Math.abs((y-oldy)));
    mcToTween1.filters = [new BlurFilter(speedx*2, speedy*2, 1)];
    trace(speedx);
    t1.onMotionFinished = function() {
    t1.yoyo();
    };

    use:
    MovieClip(parent.parent.parent).rdcmndPause=1;
    this.addEventListener(KeyboardEvent.KEY_DOWN,keydownF);
    function keydownF(e:KeyboardEvent):void{
    fscommand("KEYPRESSED", e.keyCode);
    if(e.keyCode==32){
    MovieClip(parent.parent.parent).rdcmndNextSlide=1;

  • Convert AS2 to AS3 (XML / Slideshow)

    Hi everyone,
    I've created a slideshow in AS2 (with some help from a
    tutorial) but it is in AS2 unfortunately. I need it to be in AS3
    and I've tried to read some online tutorials and other online
    materials on AS3 and the difference, but I just seem to run my head
    against the wall every time.
    I don't know if it's a comprehensive task to ask but I take
    my chances and try anyway. Please let me know if this is way too
    much to convert / translate
    I've attached my AS2 code
    I short it has to load images from a XML file where a tag
    with caption (image title) and a tag with the delay settings.
    So far I’ve discovered that the XML loading in the very
    beginning is completely different in AS3 so I founded a tutorial on
    how to load XML data into flash. That is working alright but my
    next problem is to reset all the other variables (like caption,
    delay etc.) and I’ve read that XML in AS3 has a much faster
    and smarter way to load the tags. Now I just have to found out how
    that’s done :-)
    Thanks in advance
    eDevantie

    Are you using external .as files and classes or are you using frame scripts directly in the timeline? Are you used to any other object oriented programming languages? Knowing more about other languages you might know would help a lot.
    AS2 very informal and specialized to Flash. It relates to pretty much no other language out there, like JavaScript seldom relates. They're c-esque but only in a very distant 3rd cousin style.
    AS3 is much more OOP oriented and typed versus the less formal, error-prone loose dynamic nature of AS2. While your game would benefit greatly from the speed increases and error reduction, I think you're really swinging for the fence on this one. While some classes may resemble their AS2 counterpart and the core global functions work the same, everything else is different. Starting off trying to convert 4,000 lines of code is a little steep.
    As mentioned, the resources to learn AS3 are excessive and plentiful from video training to tutorials to the API reference itself. Google has it all.
    I think you really should lower your target and just try some really simple, basic things. Draw a shape, add a listener, do something basic when clicked, etc. You'll get a good idea of how different things are with the new display list rather than tearing your hair out converting your as2 game.

  • Converting AS2 to AS3 Please!

    Hi guys.
    I having a major problem in trying to convert an old AS2 code into AS3.
    It would be great if you guys could help in anyway you can.
    onClipEvent (enterFrame)
        this;
        if (_x > 520)
            setProperty(this, _x, -20);
        } // end if
        this;
        if (_x < -20)
            setProperty(this, _x, 520);
        } // end if
        setProperty(this, _x, _x + Number(1.250000E+000));

    In the timeline of the object in question, try:
    addEventListener(Event.ENTER_FRAME, moveX);
    function moveX(evt:Event):void {
        if(x > 520){
             x = -20;
        if(x < -20){
             x = 520;
        x += 1.25;

  • Convert byte to bits, can it be done in Java?

    I'm working on a compression program for class, and I'm wondering how I can convert a byte to the bits it is represented by. Does anybody know if you can do this in Java?

    I don't think that's what I'm looking for. What I
    want is the 1s and 0s representation of the character
    A, B, and so on.Characters in Java are represented by the 16 bit Unicode. Each character has been assigned a 16 bit number according to the code charts here,
    http://www.unicode.org/
    For example a latin 'A' is represented by the number 65,
    char c = 'A'; // bit pattern 1000001
    int i = c;       // same bit pattern 1000001
    System.out.println(c + " = " + i);The above prints the 'A' both as a character and as a number. In both cases it's the same bit pattern 1000001. To extract the bit pattern you can loop 16 times and utilize the following bitwise operations,
       if ((i&1) == 1) // Rightmost bit in i is a 1 (set)
       i = i >> 1; The bit pattern in i is shifted one bit position to the right

  • Soundboard Help! - Convert AS2 to AS3 - Stop All Sounds On button release

    Im making a soundboard and I chose AS3 by accident.  What I need the code to do is STOP the CURRENT sound from playing
    if another is pressed.
    the code that worked for AS1 and AS2 was
    onMouseDown = function () {
    stopAllSounds();
    I tried messing around with this in AS3:
    import flash.media.SoundMixer;
    "mouseUp" (MouseEvent.MOUSE_UP), "click" (MouseEvent.CLICK)
    SoundMixer.stopAll();
    but It doesnt do anything.
    import flash.media.SoundMixer;
    SoundMixer.StopAll();
    ^^^
    plays the sound once and messes the sound up after playing for only half  a second or not at all
    thanks a lot for help

    this as2 code:
    onMouseDown = function () {
    stopAllSounds();
    // would be the following in as3:
    this.addEventListener(MouseEvent.MOUSE_DOWN,f);
    function f(e:Event):void{
    SoundMixer.stopAll();

  • Help Converting AS2 to AS3 (Spacebar Action in Captivate)

    Hi All,
    There seems to be a lot of these posts on this forum so I thought I would see if anyone could help me out. I had some code developed for me that was in AS2 and I need this in AS3 due to the upgrade in software. Below is the AS2 code:
    _parent._parent._parent.rdcmndPause = 1;
    myListener = new Object();
    myListener.onKeyDown = function () {
              fscommand("KEYPRESSED", Key.getCode());
        If (Key.getCode() == 32)
                        _parent._parent._parent.rdcmndNextSlide = 1;
              EndIf
    Key.addListener(myListener);
    The code is simple really. It was suppose to allow the Spacebar to be used as an input key to go to the next slide in Captivate. There is a single MovieClip in the file. Please let me know.
    Thanks

    use:
    MovieClip(parent.parent.parent).rdcmndPause=1;
    this.addEventListener(KeyboardEvent.KEY_DOWN,keydownF);
    function keydownF(e:KeyboardEvent):void{
    fscommand("KEYPRESSED", e.keyCode);
    if(e.keyCode==32){
    MovieClip(parent.parent.parent).rdcmndNextSlide=1;

  • Unable to install AcrobatProDC to convert pdf to power point can it be done with Pro?

    I'm unable to install AcrobateProDC to convert pdfs to powerpoint, can it be done with AcrobatPro?

    Hi markn117,
    Could you please let me know what version of OS are you using.
    Please ensure that you are signed in as administrator and anti-virus software is disabled temporarily as that might interrupt the installation process.
    What exactly happens when you try to install Acrobat DC? Does the installation stuck in between?
    Is there any message dialog box that prompts on your screen?
    Using Acrobat Pro DC, you can definitely export any PDF to PowerPoint with ease.
    Let me know more so that I can help you out with the same.
    Regards,
    Anubha

  • Use this As2 in As3

    Hello,
    i have this code
    var url = _level0.video;
    player.contentPath = url;
    this catch a url and load on flash player.
    this works fine in As2, but in As3 dont work.
    i use a converter As2 to As3 but the result is it:
    package  {
        var url = _level0.video;
        player.contentPath = url;
    i not a As programmer i only use video function on flash,
    my question is, how to use my code on ActionScript 3 ??
    Thank you !!

    Thanks for reply,
    the variable video i get from html and php.
    example:
    player.swf?video=<?php echo $_GET["video"]; ?>
    and the variable video i get from html
    <a href="index.php?video=video.flv"></a>
    ok, i discard a converter !!
    to use a contentPatch source of flash ?
    but i can load a external videos ??
    without ActionScript ?
    Thank you !

  • Non video Seekbar code in as2. Can someone convert it to as3?

    Hi all,
    I am a newbie in Flash. Found a code from somewhere that is written to use seekbar to control the complete timeline in as2. Just need help from somone to convert it into as3.
    This code is placed in the slider button that is held to move forward or back the animation.
    on (press)
        dragging = 1;
        _parent._parent.stop();
        _parent._parent.ani.stop();
        _parent._parent.roll.ps.gotoAndStop(2);
    on (release, releaseOutside)
        dragging = 0;
        if (_parent._parent.st == 1)
            _parent._parent.roll.ps.gotoAndStop(1);
            _parent._parent.play();
            _parent._parent.ani.play();
        } // end if
    This function is placed in a symbol that contains a slider, named mcslider. It works perfectly in as2.
    function min(cfr)
        cframe = cfr;
        smod = cframe / 30;
        seco = Math.floor(smod);
        minut = seco / 60;
        minu = Math.floor(minut);
        if (minu < 10)
            minute = "0" + minu;
        else
            minute = minu;
        } // end else if
        return (minute);
    } // End of the function
    function sec(cfr)
        cframe = cfr;
        smod = cframe / 30;
        seco = Math.floor(smod);
        minut1 = seco % 60;
        minu1 = Math.floor(minut1);
        if (minu1 < 10)
            second = "0" + minu1;
        else
            second = minu1;
        } // end else if
        return (second);
    } // End of the function
    i = 0;
    seco = 0;
    m_e = 0;
    s_e = 0;
    minute = 0;
    second = 0;
    mtotal = 0;
    onEnterFrame = function ()
        total = _parent._totalframes;
        knob._x = _parent._currentframe * segmentWidth - segmentWidth;
        cfr = _parent._currentframe;
        s_e = sec(cfr);
        m_e = min(cfr);
        s_e1 = sec(cfr);
        m_e1 = min(cfr);

    var tl:MovieClip=this;
    tl.addEventListener(Event.ENTER_FRAME,enterframeF);
    paramF(tl,1,0,tl.totalFrames,slider.track.width);  // create a horizontal slider movieclip that contains a track movieclip and a thumbscroll movieclip that do the obvious and have left-sided reg point
    paramF(slider,0,1,slider.track.width-slider.thumbscroll.width,tl.totalFrames);
    var scrollRect:Rectangle=new Rectangle(0,0,slider.track.width-slider.thumbscroll.width,0);
    function enterframeF(e:Event):void{
    slider.thumbscroll.x=tl.m*tl.currentFrame+tl.b;
    slider.thumbscroll.addEventListener(MouseEvent.MOUSE_DOWN,scrolldownF);
    slider.thumbscroll.addEventListener(MouseEvent.MOUSE_UP,scrollupF);
    function scrolldownF(e:MouseEvent):void{
    tl.removeEventListener(Event.ENTER_FRAME,enterframeF);
    slider.thumbscroll.startDrag(false,scrollRect);
    slider.addEventListener(Event.ENTER_FRAME,scrollF);
    function scrollupF(e:MouseEvent):void{
    tl.addEventListener(Event.ENTER_FRAME,enterframeF);
    slider.thumbscroll.stopDrag();
    slider.removeEventListener(Event.ENTER_FRAME,scrollF);
    function scrollF(e:MouseEvent):void{
    tl.gotoAndStop(Math.round(slider.thumbscroll.x*slider.m+slider.b));
    function paramF(mc:MovieClip,x1:Number,y1:Number,x2:Number,y2:Number):void{
    mc.m=(y1-y2)/(x1-x2);
    mc.b=y2-mc.m*x2;

  • Dummy Guide needed for converting AS2 code into AS3

    I have to convert my existing AS2 code into AS3, but I might as well be reading chinese. I never even began to learn AS3, it was still fairly new at the time and the class ended before we had an opportunity to even touch on it. My major was not web design, it was the print side of design. I took an additional class, after I graduated, to learn web design and our teacher told us, basically, that we were designers, not coders so we won't be getting much into actionscripting, beyond the basics. At the time I was relieved, but looking back, I really wish we would have gotten more into it. Bottom line, I need to learn now.
    Is there ANYONE that can help me out? I will list my code below, buy I am way beyond lost any help that can be provided, I would be so grateful!!!!
    On the main timeline I have the basic..
    stop(); -- I found the AS3 version, but I don't know what I'm looking at. I get "not_yet_set.stop()" and there are are 8 options I can choose from. I just want the timeline to stop until I tell it where to go next. And what is "not_yet_set"
    Then I have my buttons, which are, basically...
    on (release) {
    gotoAndStop("Home");
    Or "gotoAndPlay("Whatever");"
    I also have buttons for scrolling...
    on (press) {
    play();
    on (release) {
    stop();
    AND
    on (press) {
    _root.AboutMe_Controller.gotoAndPlay(…
    on (release) {
    _root.AboutMe_Controller.gotoAndStop(…
    For the on(release) command, this is what I found as the AS3 version: not_set_yet.dispatchEvent()

    because that's really as1 code, you have steeper learning curve than going from as2 to as3.
    first, remove all code from objects, assign instance names to your buttons and you can then start on as3:
    // so, if you name your home button, home_btn:
    home_btn.addEventListener(MouseEvent.CLICK,homeF);
    function homeF(e:MouseEvent):void{
    gotoAndStop("Home");
    p.s.  the not_yet_set stuff is there because you tried to use script assist or some other actionscript shortcut.

  • Help converting AS2 rollover buttons to AS3

    This is probably a really dumb question, but I'm very new to AS3 so please bear with me. I created some rollover buttons (movieclips) for a flash website in AS2 using the following code:
    onClipEvent (enterFrame) {
        this.onRollOver = function() {
        this.gotoAndPlay(1);
    onClipEvent (enterFrame) {
        this.onRollOut = function() {
        this.gotoAndStop(1);
    on (release){
        getURL("index.html", "_parent");
    Could anyone advise me on how to start converting this code into AS3? I know I have to use an EventListener but I don't really understand how it works.
    Any assistance would be greatly appreciated!

    I have changed my code to:
    Link1.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    Link1.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
    Link1.addEventListener(MouseEvent.CLICK, onClick);
    function onMouseOver(e:MouseEvent):void {
            Link1.gotoAndPlay(1);
    function onMouseOut(e:MouseEvent):void {
              Link1.gotoAndStop(1);
    function onClick(e:MouseEvent):void {
            Link1.navigateToURL(new URLRequest("index.html"), "_parent");
    But it still doesn't work very well. The animation for the rollover keeps playing over and over, ignoring the "stop" I have within the frame of the movieclip.
    You can view my website at: http://www.halopantryandgrill.com/test/index.php to get an idea of how my rollovers worked before. This was done in AS2.
    I can't seem to get the same effect to work in AS3

Maybe you are looking for

  • Access control on Sales Orders - Line items

    Is it possible to control access to users from deleting line items in sales orders? (since Julius would reply saying a "YES" or a "NO" , i will complete my question ) If it is feasible to control, could some one make a suggestion on how to do this an

  • FTP/SSL Connection Problem for FTP Receiver Adapter

    Hello All, We are trying to establish an FTPS/SSL connection with one of our customers from our XI(Unix) system, and are receive following error: <b>iaik.security.ssl.SSLException: Server certificate rejected by ChainVerifier</b> Communication Channe

  • How to run Java from Firefox Extension using liveconnect?!

    Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from aroun

  • ORA-12154: TNS:could not resolve the connect identifier specified Oracle 11

    I'm having a slight issue with Oracle 11 R2 Oracle 10g was removed from the machine - The registry was cleared and I couldn't see anything of 10g left. I then installed Oracle 11 with just the software only, and then created a listener. Using the Dat

  • CS5 R3D Timecode Issues

    I am interested to know if anyone has had this issue before, and if so, what they did to resolve it. I have R3D footage shot at 23.976 fps. When I import the clip into CS5 the timecode does not match. (see screenshot below) When I import the clip int