Migrating to AS3

I'm been comfortable developing in AS2 for a while now, and it pretty much still does everything I need from it.  But I think it's time to make the move the AS3. I know there will be a learning curve and I'm ready for that, plenty of resources out there at my disposal.
The one question I have now is - will Flash "convert" previous AS2 code to AS3?  IIRC, it did when we went from AS1 to AS2.

I haven't had formal education in OOP, just what I've picked up here and there. One thing I'm expecting is thatit will be a lot more than discovering AS3 counterparts to AS2 language.  It sounds like it's a whole new approach with a new way of thinking. In that regard, I can see why perhaps in may be more difficult for someone with AS2 background vs someone without, or with another type of programming experience more closely related.
But I still may have an advantage in that I never made full use of what AS2 could do.  For example, and I'm a little ashamed to admit this, I only recently started using the Tween class - it was always keyframes.  Sure, I've done more complicated scripting, just not that one and found out how easy it was and slapped myself in the forehead for doing it the old way for so long.  And the, the only reason I finally did tween with AS, was that I was forced into it because I needed create a shape tween with dynamic values for the dimensions.  But I don't feel forced into learning 3, unless that's all that's supported in the next version of Flash - which could very well happen!

Similar Messages

  • Migration to AS3

    I have been using Flash and Actionscript for some
    years now and I have found it very difficult to take on board at
    times. I keep promising myself that I will get to grips with
    Actionscript so that the applications I develop look as good as the
    ones I see in Web Designer magazines. However, after a really big
    effort to complete my prefered Actionscript2 book (Flash MX
    2004-Derek Franklin/ Jobe Makar-training from the source) I find
    myself questioning my efforts and start to wonder if AS3 is going
    to be easier to get to grips with. I have read reports on AS3 being
    ten times faster in terms of its processing power, but what
    percentage of the web industry has migrated to AS3? Do I forget AS2
    and focus my efforts on AS3 in order to improve my development
    skills and gain a better position in the job market or what?

    For AS3 I'd suggest:
    ActionScript 3.0 Game Programming University (QUE) by Gary
    Rosenzweig. I find Rosenzweig's books to be a great start. He
    doesn't go into massive depth, but presents a bunch of projects
    that you can get up and running quickly; learning in bite-sized
    pieces.
    Learning ActionScript 3.0 (O'Reilly) by Shupe and Rosser.
    Very good, even though the writing style is sometimes comically
    erudite.
    Essential ActionScript 3.0 (O'Reilly) by Colin Moock. I like
    Moock's instruction, though he tends to get sidetracked in a lot in
    minutiae. The whole book's devoted to creating a single project...
    that you sometimes feel will never end.
    As for Flex, I've picked up a copy of
    Adobe FLEX 3 - Training from the Source (Adobe Press), but
    haven't had the opportunity to take a crack at it.

  • SwapDepth migration to AS3

    I have converted AS2 Carousel to AS3 and it works fine without swapDepth line, which is:
    this.swapDepths(Math.round(this._xscale) + 100);
    I need to convert this line to AS3 ... it's very important because it prevents overlapping between layers.
    the place for this line should be inside "mover" function.
    My Code is:
    var numOfItems:Number = 5;
    var radiusX:Number = 200;
    var radiusY:Number = 30;
    var speed:Number = 0.05;
    var arrItems:Array = new Array();
    //var angle:Number = 0;
    for (var i:uint = 0; i < numOfItems; i++){
        var t:dress1 = new dress1();
        t.angle = i * ((Math.PI*2) / numOfItems);
        addChild(t);
        t.addEventListener(Event.ENTER_FRAME, mover);
        t.addEventListener(MouseEvent.MOUSE_OVER, over);
        t.addEventListener(MouseEvent.MOUSE_OUT, out);
    var centerX:Number = stage.stageWidth / 2 - t.width / 2;
    var centerY:Number = stage.stageHeight / 2 - t.height / 2;
    function mover (e:Event):void {
        e.currentTarget.x = Math.cos(e.currentTarget.angle) * radiusX + centerX;
        e.currentTarget.y = Math.sin(e.currentTarget.angle) * radiusY + centerY;
        var s:Number = e.currentTarget.y / (centerY + radiusY);
        e.currentTarget.scaleX = e.currentTarget.scaleY = s * 1.5;
        e.currentTarget.angle += speed;
    var test = speed;
    function over (e:Event):void {
        speed = 0;
    function out (e:Event):void {
        speed = test;
    Thanks and Regrads,
    SPrince

    you'll need to check those angles and use addChild() to move a dress1 to the top.

  • Migrating array functions from AS2 to AS3

    The code below is meant to load randomly selected "koan swfs" into a movie clip on the main root timeline called "koan_loader_mc" using a loader called "koan_loader."  Are the actions of this array correctly migrated to AS3?  Thanks for your help
    // creates function called at the end of koan_#.swfs  
    // this code is in the first frame of the root timeline
    Array.prototype.shuffle = function() {
    for (var ivar = koan.length-1; ivar>=0; ivar--) {
    var p = random(ivar+1);
    var t = this[ivar];
    this[ivar] = this[p];
    this[p] = t;
    MovieClip(root).index=0;
    var koan_loader:Loader = new Loader();
    var koan:Array =["swfs/koans/koan_1.swf","swfs/koans/koan_2.swf", "swfs/koans/koan_3.swf", "swfs/koans/koan_4.swf", "swfs/koans/koan_5.swf", "swfs/koans/koan_6.swf", "swfs/koans/koan_7.swf", "swfs/koans/koan_8.swf", "swfs/koans/koan_9.swf", "swfs/koans/koan_10.swf", "swfs/koans/koan_11.swf", "swfs/koans/koan_12.swf"];
    koan.shuffle();
    koan_loader.load(new URLRequest(koan[index]));
    MovieClip(root).koan_loader_mc.addChild(koan_loader);
    This is the code in a frame at the end of koan swfs:
    MovieClip(root).index++
    if(root.index>_root.koan.length-1){
    root.index=0;
    root.koan.shuffle();
    var koan_loader:Loader = new Loader();
    koan_loader.load(new URLRequest(koan[root.index]);
    MovieClip(root).koan_loader_mc.addChild(koan_loader);
    loadMovie(_root.koan[root.index]);

    function shuffle(a:Array) {
    for (var ivar = a.length-1; ivar>=0; ivar--) {
    var p = random(ivar+1);
    var t = a[ivar];
    a[ivar] = a[p];
    a[p] = t;

  • Major gaming system Migration from AS2 to AS3

    I have a major project entirely in AS2. It is made of a
    Multimedia Application, which provides access to functions needed
    to load games, save information, insert *.jpg files... The 50+
    games each have their own graphic.swf and engine.swf, where the
    graphics deal with gameplay and the engine communicates with the
    Multimedia Application.
    If the Multimedia Application is migrated to AS3 but the game
    swf files remain the same, will the functions still be able to
    communicate (call functions and send references to objects)?

    No, AS2 and AS3 are absolutely different animals. There are
    some techniques (search for as2 as3 bridge in the net) that create
    a bridge which are cumbersome in my view.

  • AS3... why?

    what is the point of AS3?. Why is there AS3?.. what doors of possiblities does it open?
    I wouldn't mind if AS3 was an extention to AS2 but it seems to be completely different, not similar to other languages, and takes ten times as long to code something simple as it did with AS2..
    before people respond with well just use AS2 I would, however every flash job is for people that can AS2 and AS3...
    am i going to spend ages learning AS3 to find that adobe have already launched AS4, which im sure will have no relation to AS3?
    ... sorry for a rant and possibly a pointless post, but thats life.

    Hi, Jonny.
    First, considering the advantages of AS3 over AS2, one of the most important is that more and more developers are migrating to it, it means that inevitable the AS2 community will slown down...
    But, let's go to the languages advantages. First: the new VM of Flash Plugin, the one that runs AS3 is kind of 100 times faster! Run this simple test and confirm what I'm saying:
    [AS2]
    var initTime:Number = getTimer();
    var endTime:Number;
    for(var i:Number=0; i < 1000000; i++)
    endTime = getTimer();
    trace(endTime - initTime);
    [/AS2]
    [AS3]
    var initTime:uint = getTimer();
    var endTime:uint;
    for(var i:intr=0; i < 1000000; i++)
    endTime = getTimer();
    trace(endTime - initTime);
    [/AS3]
    AS3 is really a very superior language. About the time to develop, I also has this impression: AS3 is much more exigent than AS2. But, go for my words, when you get it, you gonna see you will have a much faster and consistent development, without annoying bugs and this stuffs.
    I really think that everyone sould migrate to AS3. If you're not convinced yet, some other features:
         Native support to 3D;
         Access to Local File system;
         Native peer-to-peer support coming there (look for Stratus);
         indexOf method in the Array, that became much times faster;
         Control of the loaded data at the byte level (ByteArray);
         Typed vectors (making array much more faster);
         Consistent event structure;
         An incrideble RegExp solution;
         And so on...
    AS4 is not about to be launched. It'll take time to. The AS3 language is more compliant with the standards of development, and I believe that it can pass by a improvement on the plugin side, but the language will stay stand for many years. Years enough to worth learn the AS3 and be prepared to the 4. Anothe little advantage, it's very similar to Java, for those familiarized with Java.
    These are only some of the advantages of the AS3 engine... but, pal, go AS3!
    Cheers,
    CaioToOn!

  • CF11 Actionscript 3 - I'm migratiing from AS2 and can't use REMOTING, so how to use cfc's and process their results?

    The CF11 integration notes describe how to do use Flash Remoting. I use that in my AS2 code and it works fine. I'm trying to migrate to AS3 where there is no Remoting. I have done the following:
    import flash.net.*;
    import flash.events.*;
    var CFCService = new NetConnection()
    CFCService.objectEncoding = 0;
    CFCService.connect("http://localhost:8500/flashservices/gateway/")
    var responder2 = new Responder(getActiveUsers_Result, onFault);
    CFCService.call("cfc.SyslockComponents.getActiveUsers", responder2);
    stop();
    function getActiveUsers_Result(result:Object):void
        trace("getActiveUsers Result Status: " + result.STATUS);
        for (var property:String in result)
            trace(property +" : " +result[property]);
    The OUTPUT of my program shows the contents of the STRUCT returned by the CFC:
    getActiveUsers Result Status: ALLOK  <<<<<< the CFC completed successfully
    RECCOUNT : 1  <<<<<<<< There was one record select by query
    DETAILS : [object Object]  /<<<<<< this contains the query results
    STATUS : ALLOK
    I don't know how to process DETAILS because RECORDSET is not available in AS3.

    S/he's only offering six Dukes here:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=469450&start=0&range=15#2169975
    This problem has been done before. Break this down into something simpler. You don't need an applet. Just do it on the command line. You don't need a database. Just create a flat file if you need some persistent data. Do the simple thing first, then build out from there.
    Click on the special tokens link up above and learn how to use [ code][ code] tags.
    Your code is a big, unreadable mess. You've got pare this down into something sensible. If you can't understand it, it's unreasonable to expect someone on this forum to wade through all of that. - MOD

  • Display base64 encoded image in flash

    how to decode the base 64 representation of the image?

    Has any played around with the bitmapdata classes to see if
    there are any undocumented was to convert the decoded base64 (now
    binary) into pixel data? Until we migrate to as3 (huge
    undertaking), I really need a way to use the base64 strings from a
    web service as images in flash. I'm going to keep playing and
    digging, but in the meantime, if someone can shed some light here
    on how to do this with AS2, I would bow to your "sherlock
    holmes-ness".
    Thanks

  • Scheduling Framework howto??

    Hi All
    I am pretty new to flex. I am descent with as2 and are
    starting to migrate to as3. I am trying to build an events calender
    in flex. I found the Scheduling Framework but cant seem to even get
    working their samples. Is there something I am missing? Is there
    some sort of install process for the library? Not much
    documentation in that area on this for us newbies. Any help would
    be great.
    Dave

    Anyone??

  • Migrate existing code of AS3 to AS2 - URLRequest, URLLoader

    Hi,
    I have written code to read an XML file by using URLRequest and URLLoader in ActionScript 3.0. Code is pasted below. This runs well in AS3.  Problem I am facing is because I wrote this in AS3, I am not able to use the DateChooser component in another part of the flash module because it seems like DateChooser component is not supported in AS3. So I want to migrate my below AS3 code back to AS2.
    **** Code in AS3 (I need help in writing equivalent code in AS2) :-
    var xmlText:XML ;
    var xmlReq:URLRequest = new URLRequest("myFile.xml");
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(xmlReq);
    xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
    function xmlLoaded(event:Event):void
        xmlText = new XML(xmlLoader.data);  
        info_txt.htmlText = xmlText.someTag ;
    **** I cannot use the above as is because, when I change the publish settings from AS3 to AS2, I get following errors -
    The class or interface 'URLRequest' could not be loaded.
    The class or interface 'URLLoader' could not be loaded.
    The class or interface 'Event' could not be loaded.
    Same works well in AS3. What should I do to make this work in AS2 or can anyone direct me in writing an equivalent in AS2.
    Please assist.
    Thanks in advance.
    MG

    parsing is done using the xmlnode methods and properties.  how you parse an xml file (in as2) depends on its structure.  but generally, you use firstChild, nextSibling, childNodes and nodeValue in the appropriate sequence to extact data.  the flash help files have sample code.  for tutorials, check google.
    if you're trying to load a cross-domain xml file, you'll have a cross-domain security issue to deal with.

  • Migrating AS2 Code to AS3

    ORIGINAL AS1 SCRIPT
    I have already tried several ways to migrate this code, but I
    get unexpected behaviors. Can any one help me?
    The volume control on the stage is made out of two
    movieClips: one called knob and the other volume_track over which
    the knob slides (is dragged by user) This two Clips are turned into
    one movieClip called volume_control. The Sound Object is within an
    Empty MovieClip called soundMc. the pos variable gathers the knob's
    position on the volume_track.
    The following code is the original one, which works
    perfectly.

    Hi, Kglad,
    I had made a mistake, that's why the code didn't work at all.
    My bad.
    I modified a little the code you suggested as well as the
    Clips Instance Names.
    I used the Rectangle Class to get the
    startDrag(lockCenter:Boolean = false, bounds:Rectangle = null)
    method's bound argument. This is how the Rectangle is set up:
    Rectangle(x:Number, y:Number, width:Number, height:Number);
    It works now, but there's a couple of unexpected things
    happening.
    1. It really hard to make the knob move left and right
    because the cursor seems not to get a firm hold of it.
    2. Once it starts dragging, I have to move it very slowly
    otherwise I lose a hold on the knob.
    3 - In order to get the knob to drag within the bounderies of
    its track, I had to add extra numbers in the x (8 instead of 0),
    width (a -12), and height (0 instead of e.currentTarget.y), but
    this poses a problem later when I try to get a definite value to
    control the volume intensity between 0.0 (Minimum volume) and 1.0
    (Max Vol). Tracing pos, I got these results:
    Min pos: 0.10810810810810811
    Max pos: 0.9459459459459459
    Is there a way to clean up those results, like a Math
    function, so that I can get something like this 0.1 and 0.9 instead
    of those long numbers?
    volume_control.volKnob.addEventListener(MouseEvent.MOUSE_DOWN,
    dragKnob);
    volume_control.volKnob.addEventListener(MouseEvent.MOUSE_UP,
    stopKnob);
    volume_control.volKnob.addEventListener(MouseEvent.MOUSE_OUT,
    stopKnob);
    var t:Timer=new Timer(70,0);
    t.addEventListener(TimerEvent.TIMER,volF);
    function dragKnob(e:MouseEvent) {
    trace("Begin dragging");
    var rect:Rectangle = new Rectangle(8, e.currentTarget.y,
    e.currentTarget.parent.volTrack.width-12, 0);
    e.currentTarget.startDrag(false, rect);
    t.start();
    function stopKnob(e:MouseEvent) {
    trace("Stop draggin");
    e.currentTarget.stopDrag();
    t.stop();
    function volF(e:TimerEvent) {
    var pos:Number =
    (volume_control.volKnob.x/volume_control.volTrack.width);
    //soundObjChannel.soundTransform.volume =pos; // you need to
    define your soundChannel object whereever you're applying the play
    method to your sound object
    trace("pos" + pos);
    }

  • AS2 to AS3 migration of code...

    ==============
    This code is in AS2
    ==============
    _root.createEmptyMovieClip("tmp",900);
    _root.createEmptyMovieClip("tmpLoded",101);
    _root.interval = setInterval(_root.logger,5000);
    loadVariables("http://www.site.com/trackL.php?eid="+_root.id+"&rdoc="+_root.rdoc+"&str="+_root.generateRandomStr(),_root.tmpLoded);  
    function logger () {
    loadVariables("http://www.site.com/track.php?eid="+_root.id+"&str="+_root.generateRandomStr(),_root.tmp);
    function generateRandomStr () {
    var dt = new Date();
    var str = dt.getMilliseconds()+""+dt.getSeconds()+""+dt.getMinutes()+""+dt.getHours()+""+dt.getDate ()+""+dt.getMonth()+""+dt.getFullYear();
    return str;
    trackL.php - tracking if it loads correctly
    while
    track.php - will be generated periodically every 5 seconds.
    How would I pass a variable from flash to php?
    I've been in many tutorials in the net but I cannot understand much of the tutorials...
    I only saw same method like using URLRequest & URLLoader with the location of the php files then the variables in the php which connects to the database is accessible.
    All are accessing the php not passing flash variables to the php file like in the above code.
    All help is greatly appreciated.

    that's really poor as2 coding so it will translate to really poor as3 coding.
    but, to answer your question, you assign a data property to your urlrequest to convey data from flash to php.  the data property will be a urlvariables instance and you assign variables/values to your urlvariables instance:
    var urlVar:URLVariables=new URLVariables();
    urlVar.eid=whatevervalue;
    urlVar.rdoc=whatever;
    urlVar.str=whateverelse;
    yourURLRequest.data=urlVar;

  • Migrate from AS1 to AS3

    Hi,
    I have old pice of code that i'd like to use in a new project. It dates back from Flash Player 4 i think.
    I tried to change a few things to AS2 that I am familiar with but that didn't work.
    Here is part of the code:
    pos = getProperty("", _name);
    if (mbsubstring(pos, 3, 1) eq "y") {
        x = mbsubstring(pos, 2, 1);
    } else {
        x = mbsubstring(pos, 2, 2);
    if (mbsubstring(pos, 4, 1) eq "y") {
        y = mbsubstring(pos, 5, -1);
    } else {
        y = mbsubstring(pos, 4, -1);
    xp1 = Number(x)+1;
    xp2 = x-1;
    yp1 = Number(y)+1;
    yp2 = y-1;
    if (Number(getProperty(target, _currentframe))<>2) {
        tellTarget ("../x" add xp2 add "y" add y) {
            play ();
        tellTarget ("../x" add xp1 add "y" add y) {
            play ();
        tellTarget ("../x" add x add "y" add yp1) {
            play ();
        tellTarget ("../x" add x add "y" add yp2) {
            play ();
    Could anybody translate it at least to AS2. From there I maybe able to go forward.

    Hi kglad,
    Can you please explain a bit more say if I have below code
    #initclip 45
    Object.registerClass("Border", mx.skins.Border);
    #endinitclip
    What should be the as3 output?
    Thanks in advance.
    With Regards,
    Sagar S. Ranpise

  • Migration plans for Stock Captivate Animations from AS2 to AS3

    The stock animations that come with Adobe Captivate were published in ActionScript 2 many years ago and carried forward with each new release of Captivate.
    This presents a problem, because Captivate publishes to ActionScript 3.
    So, I get lots of Flash Error messages popping up when I run my lessons with the debug version of the Flashplayer.
    Example:
    Error #2044 Unhandled SecurityErrorEvent:. text=Error #2047: Security sandbox violation: LocalConnection.send:  ...
    If I could find the original FLA files, I'd republish them myself, but I can't find them on my drive.
    Does anyone know where I can find this source code?
    I hate to have to do this every time I install a new version of Captivate, but the Adobe developers seem oblivious/apathetic to this recurring bug.
    Thoughts? Comments? Suggestions?

    No, the MovieClip class is still dynamic so you can add
    properties. If you extend MovieClip but you dont declare your
    subclass dynamic, then you cannot add properties.
    To access a display list you need to use getChildByName or
    getChildAt. If you would add an instance name on your tf you can
    retrieve that tf using getChildByName(), see attached snippet
    (assuming you assign an instance name in the loop using tf.name =
    "tf";
    You need to read up on the target and currentTarget
    properties of events.

  • What is the best way to migrate duplicateMovieClip to AS3?

    Hi,
    In our project, we have seperate controller file for all the
    code and seperate for graphical assets. I mean, they both generate
    seperate swf files. Controller actually load the graphical assetts
    by Loader. I am still using Flash9 preview, as it will take a
    couple of days to get licences for CS3.
    The problem is, I have a movie clip inside the graphical
    assetts file, and it used to duplicate just fine in flash 9. Now I
    also gave it a a class name ItemMC and exported for action script.
    But it is giving me this error.
    ReferenceError: Error #1065: Variable ItemMC is not defined.
    while doing this
    var item_mc:MovieClip = new ItemMC();
    I also tried using getQualifiedClassName and
    getDefinitionByName using the existing instance of ItemMC, but it
    didn't work either. It was returning the right class name of ItemMC
    but it is still not instantiable. Any suggestions?

    >> Now I also gave it a a class name
    ItemMC and exported for action script. But it is giving me
    this error.
    ReferenceError: Error #1065: Variable ItemMC is not defined.
    while doing this
    var item_mc:MovieClip = new ItemMC();
    <<
    When you give a MC a class name in the linkage properties you
    are not making
    that MC a class that you can instance using new. That is for
    defining a
    custom class that you wrote which can extend the MovieClip
    class.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

Maybe you are looking for

  • Creation of new SRID ... keep getting errors

    Hi all I have trouble creating new SRID , the Images i have are in LCC projection with Everest Spheroid and Indian Datum . There is no SRID for this combination in SDO_COORD_REF_SYSTEM or CS_SRS tables. So i thought of creating a new SRID . Here is t

  • ITunes 10.5 crashes when iPhone 4 plugged in

    After my partition got corrupted last night (thanks 10.7.2 and FileVault!) I restored from a 1 month old backup. I updated to 10.7.2 and iTunes to 10.5. Now when I plug my iPhone 4 in (Running iOS 5 GM), it tells me I need to put the passcode in and

  • Bug LabVIEW PDA

    Has anybody experienced this 'bug' in LV PDA? If trying to update the value of a horizontal scrollbar using a local variable, the PDA application shuts down with no error message. Thanks

  • Displayport monitor ( 2560x1440 ) to Thunderbolt

    Hey! I own this Samsung S27B970D, 27" @ 2560x1440. I can't find any adapter to connect my macbook pro 15" retina (2800 x 1800) to the monitor. I only have the HDMI option ( which is HD, 1920x1080, blurry, sad ). Thunderbolt to DisplayPort should exis

  • Can I take a broken USB wire to Apple Store for replacement (within Warranty)?

    That's my question, the USB is broken on both sides, can I just walk into the Apple store, show them my iPhone in warranty and get a replacement?