Mike Chambers

code = joy

Suggestions for ActionScript 3 Migration Cookbook?

with 49 comments

As part of some of my recent work and research into ActionScript 2 to ActionScript 3 migration, I am working on an AS2 to AS3 migration reference cookbook. The core of the reference is the cookbook section which shows how to do commons tasks in ActionScript 2 and then ActionScript 3. The reference is targeted at users using Flash Pro to create animations and / or motion graphics and includes cookbook examples such as opening a URL, playing a sound, etc…

So, what cookbook examples would you like to see? I am looking for frequently used code snippets / tasks that may require different code in ActionScript 3.

Post any suggestions in the comments.

Btw, the guide will be released for free under a Creative Commons license.

Written by mikechambers

February 4th, 2009 at 9:59 am

Posted in General

49 Responses to 'Suggestions for ActionScript 3 Migration Cookbook?'

Subscribe to comments with RSS or TrackBack to 'Suggestions for ActionScript 3 Migration Cookbook?'.

  1. Interesting concept… first, I wonder though, if someone is really capable at AS2 couldn’t they migrate on their own? I mean, you’ve certainly established there are many capable AS2 folks who aren’t switching–but I’m not sure the reason is because they have no resources. Rather, it’s because they don’t see any benefit. (And arguably, there sometimes isn’t a benefit.) Seems like maybe it’d make more sense to write a convincing argument in favor of AS3. (But don’t just cherry pick the cases where AS3 is WAY better or lucent that AS2.)

    Brendan Dawes had some interesting equivalents he wrote up… like loadMovie() but just wrapped so you can use the old style. That might be an interesting tact, but it also might not help people make the leap.

    I’ll try to think of more specific suggestions, but I just wonder what the slant is. Is it “here’s some AS3 code so you don’t need to learn it” or “here’s some code so you can understand it”. I just keep thinking there’s no way to learn something difficult without working.

    Phillip Kerman

    4 Feb 09 at 10:05 am

  2. A couple of very simple examples…

    - E4X
    - How Document Classes work
    - Protected vs. Private vs. Public, etc…
    - Design Patterns (this might be too complex, hell I don’t even understand em :D)
    - Preloader
    - FlashVars
    - other loaderInfo stuff
    - Protected vs. Private vs. Public, etc…

    Josh Dura

    4 Feb 09 at 10:08 am

  3. Oops, copy and paste error at the end there.

    Josh Dura

    4 Feb 09 at 10:08 am

  4. Two quick ones from the top of my head which you probably already have (been a while since I’ve had to use AS2):

    AS2: createEmptyMovieClip(…)
    AS3: new MovieClip(…);

    AS2: _alpha 0 – 100
    AS3: alpha 0 – 1

    Will

    4 Feb 09 at 10:08 am

  5. Initially, one of the things I had trouble with the most was handling of button events. Maybe its something too simple to include, but I smacked my forehead quite a bit while migrating.

    Kevin V

    4 Feb 09 at 10:09 am

  6. FLVPlayback! I’d like to really appreciate the differences between the AS2 and AS3 version properly. It’s possible to patch some stuff together from various blogs etc, but in one place would be awesome…

    Pete

    4 Feb 09 at 10:09 am

  7. First one that comes to mind, though not sure it applies to your core audience:

    attachMovie() in AS2

    getDefinitionByName() in AS3

    Of course, if you have a better way, pls share.

    Dave

    David Ortinau

    4 Feb 09 at 10:09 am

  8. Using global/_level0/_root vs. stage or public static

    Calling methods of .parent vs. dispatching events

    onReleaseOutside()

    Moving attached mc/button code to the timeline

    Creating objects dynamically and referencing them later (aka. programmatic “instance names”)

    Making a customizable nav/layout using xml or json.

    Rob

    4 Feb 09 at 10:21 am

  9. Mike,

    No cookbook for migration would be helpful without examples that handle these migration items:
    http://livedocs.adobe.com/flex/3/langref/migration.html

    Of course, I realize that *you* knew about this page, but I wanted the page documented here so that others can find it as well. It is a really good reference (as most pages in the Live Docs tend to be).

    Leif
    Atlanta

    Leif Wells

    4 Feb 09 at 10:25 am

  10. @phillip


    if someone is really capable at AS2 couldn’t they migrate on their own?

    What we have found is that in general “developers” have been able to make the transition when they need / want to, in part because almost all of the AS3 docs are targeted at developers.

    However, if you are a non object oriented programmer, than the transition is more difficult in part because our documentations assumes a baseline knowledge of more advanced programming concepts.

    mike chambers

    mesh@adobe.com

    mikechambers

    4 Feb 09 at 10:36 am

  11. The biggest difference I found when I first switched, and that I have heard others lament, is loading other SWFs and communicating between them. It was dead simple in AS2 to use one base SWF and load separate ones for different sections of your site, other functionality, etc. Once loaded, communicating between SWFs was a cinch as well. This is drastically different in AS3 and I will admit I never even figured out how to really do it. My AS3 experience is almost fully Flex and its not nearly as common/relevant there.

  12. @leif

    Thanks for the link. That resource / table is going to be included in the reference.

    mike chambers

    mesh@adobe.com

    mikechambers

    4 Feb 09 at 10:36 am

  13. Additional for more simple/frequent use function

    - getURL(), navigateToURL
    - drawing api
    - a custom event for passing additional variables

    Jirasak

    4 Feb 09 at 10:48 am

  14. As previously stated, a good one to have is the difference between _root and stage. You might want to go in a little deeper explaining the reason why you can’t access stage until the display object is on the display list, that’s one “gotcha” that I experienced when I just started with AS3.

    Also, the override command is a good one to cover.

  15. There are also a couple of different flavors of books that cover AS2 to AS3 migration.

    http://www.amazon.com/ActionScript-3-0-Migration-Guide-Making/dp/0321555589/ref=sr_1_1?ie=UTF8&s=books&qid=1233771882&sr=1-1

    http://www.amazon.com/ActionScript-3-0-Pocket-Reference-Quick-Answer/dp/0596526962/ref=sr_1_2?ie=UTF8&s=books&qid=1233771984&sr=1-2

    http://www.amazon.com/ActionScript-3-0-Pocket-Reference-Professionals/dp/0596513909/ref=sr_1_3?ie=UTF8&s=books&qid=1233771984&sr=1-3

    http://www.amazon.com/ActionScript-3-0-Quick-Reference-Guide/dp/0596517351/ref=sr_1_1?ie=UTF8&s=books&qid=1233771984&sr=1-1

    You probably already know about these, but they might be able to help you out in what (or what not) to use.

    Personally, the event model was tricky, but OOP was the biggest thing for me, as I did most of my work on a timeline at my position then. Those are the two big ones I think.

    Thanks Mike.

    Kevin Suttle

    4 Feb 09 at 11:30 am

  16. Garbage collection might be nice to cover.

    Ian

    4 Feb 09 at 11:32 am

  17. I think it’s important to cover the implementation of AS3 into a Flash project, where you don’t have code on each movieclip anymore. This is a hard concept for a lot of AS2 dependent designers. They can’t seem to get past the on(release), and other AS2 inconsistencies. It didn’t help that Adobe was promoting “Behaviors” to be added to movieclips, back in the Flash 8 days.

    The confusion people still have is that it’s possible to have code on the timeline, but also this new concept of the document class. So anything to clarify that would be great.

    :D

    iBrent

    4 Feb 09 at 11:37 am

  18. Hi Mike,
    I think the changes in the event mechanism is important to focus on – especially added/removed to/from stage vs on load/unload. Some templates people can use to get going with MovieClip subclasses would be helpful.
    Yours truly,
    -Brian

    Brian Lesser

    4 Feb 09 at 11:40 am

  19. I think that the most common tasks I have noticed that a designer who code in AS2 use to:
    - build photo galleries (loadMovie/MovieClipLoader/createEmptyMovieClip/attachMovie)
    - contact form (LoadVars/loadVariables)
    - read XML,
    - buttons handlers(onPress, onRelease, onReleaseOutside, onRollOver, onRollOut),
    - using tweens engines like Tweener/Fuse/…. or even the native Tween,
    - build mini games
    - do a lot of banners
    - timeline control (play, stop, gotoAndPlay, gotoAndStop, …)

    Pedro Taranto

    4 Feb 09 at 11:43 am

  20. Just playing devils advocate here, but for a flash designer who is currently working on projects like banners, flash sites, animations, etc, what is their incentive to learn AS3? For a developer, we see lots of advantages but does your average Flash designer see those benefits? Functionally, there is very little that a Flash designer can do in AS3 that can’t be done with AS2. Many Flash designers who I’ve spoken to feel that AS3 is restrictive and slow to work in and doesn’t seem to add much. All those things (strict data typing, consistent events, code speed, run-time error, etc) that as a developer I enjoy having, are the very things that they seem to not like.

    I think a migration guide from AS2 to AS3 is easy from a syntax and best practices point of view, but until Adobe can show the average “Flasher” that is makes sense for them to make the move (give them a whole bunch of new AS3 only designer tools, or deprecate AS2), I just don’t see the Flash designers I know putting much effort into it. Right now, most of them know they should probably learn it as some point, but there is no rush.

    John

    4 Feb 09 at 11:53 am

  21. Hi Mike,

    You might check out the Adobe Developer Library title “The ActionScript 3.0 Quick Reference Guide:
    For Developers and Designers Using Flash CS4 Professional”

    http://oreilly.com/catalog/9780596517359/

    It’s essentially a migration guide (at one point we’d mulled calling it as much), and our deal with Adobe allows you to use 20% of the material. Not sure if you can place the material directly into your book, but we might look into working something out.

    –Steve

    Steve Weiss

    4 Feb 09 at 11:59 am

  22. The absolute most important thing you can tell anyone switching from AS2.0 to AS3.0 – it should be printed in bold, blinking text at the top of your next blog post, and all over the back front and side of the cookbook, is that when you switch an old AS2.0 fla to AS3.0 fla, you will not get the default AS3.0 behavior!!!!

    Instead, you will get the AS3.0 behavior with the Settings check boxes “Automatically declare stage instances” and others unchecked! This will cause every tutorial on the net, every example in the documentation, everything you can imagine that should work – it will cause it all to fail – in baffling ways (why would I have to import Accessibility anything!? argh!), and make it that much harder to learn how to use AS3.0 instead of AS2.0.

    Just one of the many things that should be fixed in Flash Pro, before you ask anyone to migrate. Since it will not likely be fixed, please at least mention this multiple day wasting error in the Flash IDE.

    Kevin Newman

    4 Feb 09 at 1:38 pm

  23. I’m not trying to shamelessly promote (although I guess it doesn’t hurt) but I have a section on my blog dedicated to AS2 > AS3 code conversion. You can find the link here:

    http://evolve.reintroducing.com/category/as2-to-as3/

    I’ve tried over the past year and a half to cover most of the stuff that was useful for me (most of it is very basic, at least in my opinion) and have gotten good feedback on the posts I’ve made, even something as simple as how to dynamically mask in AS3 compared to how we used to do it in AS2. I can tell you, however, that the most visited topics pertaining to code conversion are masking, loadvars (contact form), depth management, and custom events. i see those four things pop up on a daily basis in search terms people used to get to my blog.

    hopefully some of that info helps in writing your cookbook.

    Matt Przybylski

    4 Feb 09 at 2:35 pm

  24. A whole microsite loading content.

    Comet!

    4 Feb 09 at 3:39 pm

  25. Not exactly sure if this belongs to specific examples that you are looking for but one of the most frequently asked question is how to do onMouseReleaseOutside in AS3.

    Ronnie

    4 Feb 09 at 4:54 pm

  26. @Matt


    http://evolve.reintroducing.com/category/as2-to-as3/

    That is an awesome resource. I just bookmarked it.

    Thanks for posting.

    mike chambers

    mesh@adobe.com

    mikechambers

    4 Feb 09 at 6:02 pm

  27. One of the things that many times gets in the way of migration guides is overly complex examples – filled with code that isn’t relevant – the Adobe docs can be guilty of this too. So any guide should be super simple and super relevant.

    One of the things I found most frustrating is how to specify a class name dynamically – as in the old school dynamically attaching a movie and using a dynamic name. God that one had me stumped for a long time. Those kind of things in a cookbook would be fabby.

    Love from Manchester.

    Brendan Dawes

    5 Feb 09 at 2:57 am

  28. One important aspect of AS development of complex RIAs that has not been properly explained anywhere and could be covered in such a book is hot to compile SWFs in the Flash CS4 IDE referencing but excluding specific AS3 classes. This is something that was easily and conveniently done in AS2 the previous IDEs via the exclusions declaration XML file but has no documented counterpart in the CS3-4 IDEs.

    Also porting code that relied on the NEWLINE constant in AS2 would be a nice addition. The currently proposed “\n” substitution is inadequate in multi-platform environments like the web or AIR desktop apps.

    Isaac Rivera

    5 Feb 09 at 8:53 am

  29. A section on bugs would be intensely helpful. For example, if you have a timeline animation, and you add an event to a sprite or something that has a keyframed mask, the events will be lost when the mask is keyframed.

    A similar kind of bug happens when you have a movie clip on the stage that you’d like to play under a mask, maybe some kind of looped MovieClip, or something. When the mask (not the layer with the MovieClip) is keyframed, the movie will not advance to the next frame ENTER_FRAME (though you can and must do it manually by listening to the event).

    These masking bugs and other timeline and IDE bugs, make things that have worked for years no long work as you would expect when you switch to AS3. The language is better, no doubt about that – I don’t spend any time at all working around language bugs (like trying to find out why I’m in the wrong scope and can’t access that private variable, on an event). But now I spend more time working around Flash timeline bugs – or even things that are just different, like the fact that AS3 will completely devastate your running movie if you try to access a stage clip that isn’t there (yet), where as in AS2, it would simply skip over that missing reference and keep right on trucking. I’m still not used to that, and frankly want the old javascript-like behavior back (though I’ll take added warnings in the output dialog – that was always missing from AS2. It did fail a little too silently).

    Kevin Newman

    5 Feb 09 at 9:02 am

  30. Thanks for all of the feedback. Concerning the complexity of the examples, my aim is to keep them super simple.

    For example, here is one of the entries:

    ——

    CookBook : Open a URL

    Task : You need to open a URL in a new browser window

    Solution : Use navigateToURL to open URLs in ActionScript 3

    ActionScript 2
    —————

    getURL(“http://www.adobe.com”, “_blank”);

    ActionScript 3
    —————-

    var url = new URLRequest(“http://www.adobe.com”);
    navigateToURL(url, “_blank”);

    ———————

    mike chambers

    mesh@adobe.com

    mikechambers

    5 Feb 09 at 1:16 pm

  31. I agree with Ben Clinkinbeard. A lot of the problems my AS2 proficient coworkers run into is communication between SWFs (both AS3, AS3 to AS2 is another story). I often find myself having to explain to them how class hierarchy works and how they can communicate with each other. Maybe some basic event dispatching and handling and cleaning up (something that should be mentioned more often than it is, the Timer example is always a good one).

    winrich

    5 Feb 09 at 11:18 pm

  32. Hey Mike.. I agree with the super simple examples.

    I think a lot of Flash Designer don’t know what to do if you tell them to use navigateToURL() instead getURL(). But if you show them simple “real world” examples that they just can copy/paste into the timeline, like they have done it in AS2, they’ll love you. ;-)

    Simple examples for common tasks like:
    - a preloader
    - go to a link
    - go to another frame
    - load a image
    - load and play an mp3 file
    - do something on button click
    and so on..

    simurai

    6 Feb 09 at 7:34 am

  33. It my be nice to publish some AS3 workarounds for the most common AS2 tasks. For instance getURL. What I ended up doing at work is making a top level getURL function in AS3 that behaves the same as getURL in AS2. Once they have this function it is plug and play for the old coding concept ( and much easier for them to comprehend as non-coders ).

    That one function has saved hours of phone calls that sound like, “Could you remind me again how we do getURL in AS3?”.

    Daryl Ducharme

    6 Feb 09 at 11:12 am

  34. I’d recommend to use an external IDE to write the AS3 in. Eclipse plus FDT/Flexbuilder/whats that open source one again.. ASTP?
    Probably the better still is a simple IDE like FlashDevelop, sepy, or textmate.

    kris

    6 Feb 09 at 6:39 pm

  35. AS2
    myArray = new Array()

    AS3
    var myArray:Vector.;
    myArray = new Vector.();

    By the way, the Vector Class needs to be added to the livedocs as2/as3 migration page.

    Thanks!

    Michael Kaufman

    6 Feb 09 at 7:19 pm

  36. 1.- load an image with a Loader
    2.- preloading
    3.- flashvars
    4.- e4x (XML vs. XMLList vs XMLListCollection)

    those are the things that i never remember, and have to look at docs, try it more than once, etc…

    eme

    7 Feb 09 at 5:40 am

  37. @michael kaufman

    i thought the vector class was flash player specific not AS3/AS2 specific. either way, vector vs array vs arraycollection vs dictionary vs object lol, that’s a whole different discussion, use what you need i guess.

    winrich

    7 Feb 09 at 4:48 pm

  38. An AS2-3 cookbook needs a clean explanation of the new kitchen you are in with AS3. I recommend basic information like:

    - classes and package, referring to them and importing into another .as file? How to set up a class?
    - document classes, why keep your base .fla clean? Where to put your (classes) .as files
    - basic naming and set up conventions, what to call a class? what to call a function/method? Lets cook in the same kitchen.
    - Events! button, timer, custom events and dispatching them
    - You can’t avoid OOP! I am not sure how but your examples need to show some basic OOP methods. It really needs to start peeps in the right direction.

    I know this isn’t examples but coding without the greater structure is a waste.

    Peace

    Elliot Rock

    8 Feb 09 at 6:27 am

  39. * The event model (no more delegate needed)
    * The display list
    * Packages, classes and using external APIs
    * Frameworks and OOP (and how these now apply to AS3 development, as they do all OO languages)

    SJF

    9 Feb 09 at 4:23 am

  40. I missed what SJF mentioned! The display List for sure!

    Elliot Rock

    10 Feb 09 at 4:11 am

  41. Colin Moock has a good article on why AS3 isn’t as hard as you think it is, and “debunks” a few myths:

    http://www.insideria.com/2008/01/actionscript-30-is-it-hard-or.html

    That’s a link to which I usually send people.

    Also, he did a presentation at FITC 2006 on introducing AS3 to people how at least understood AS2 concepts:

    http://www.fitc.ca/streams.cfm?stream_id=5
    or
    http://video.google.ca/videoplay?docid=-2468935003205486599&q=fitc

    The big suggestion I can make is offering an excellent explanation on why the EventDispatcher model is better than the old someClip.onRelease = function…

    The AS2 method was a bit more direct and a little less typing, but usually once I explain the benefits of multiple listeners to a single event, which can be managed independently, most people tend to at least understand the change, if not accept it.

    Also, I think a good explanation of how better error reporting is actually better. Less experienced developers tend to get frustrated when the compiler errors or the runtime errors pop up, even through either way they would have had a non-functioning program. Most people are quick to accept that yes, being told something is wrong is helpful. But understanding what is wrong is often difficult: the errors messages either need better descriptions, or there needs to be a nice cross-reference of errors and what they typically indicate and how to go about finding the actual problem.

    Lastly, I think it’s important to understand that AS3 does NOT require OOP (Moock mentions this in the article in the first link). I hear this all too often. And with Flash CS3 or CS4, you don’t need to use any classes whatsoever. I strongly disagree that OOP is necessary for all projects. While I myself hardly ever go non-OOP, I hate it when people are told that AS3 requires OOP. There’s enough to learn without adding the complexities of classes and such.

    Dru

    10 Feb 09 at 11:49 am

  42. I would really like to know how to make a mouse in / out effect for a button in as3 (mc.gotoAndPlay…?)!

    It also would be very nice to have an ActionScript for a simple login and also for a simple contact form in as3.

    Hope to see this is in your cookbook and best regards,
    Lenz

    Lenz

    15 Feb 09 at 1:16 am

  43. login script in as3
    contact form in as3

    Lenz

    17 Feb 09 at 8:50 am

  44. One thing we found took a little while to understand was to make an AS3 wrapper to load an AS2 swf which then communicated back to the AS3 movie to do some of the things that you can’t easily do now; downloading files to the local machine for example.

    We wanted to preserve our old application but allow it to take advantage of the new security features – so we have these two movies now connected using a LoacalConnection. A button on the AS2 one calls a method on the other to complete the download.

    Sue W

    19 Feb 09 at 12:02 pm

  45. I’m reading this book, and it does a great job laying down the foundational changes in AS3’s architecture for a few chapters. Then takes some high-level examples for everything from motion to bitmaps to video and shows how they’re different in AS3. http://www.amazon.com/Learning-ActionScript-3-0-Beginners-Guide/dp/059652787X/ref=cm_cr_pr_product_top

    Jeff

    27 Feb 09 at 11:36 am

  46. AS2 : duplicateMovieClip()

    guilletron

    9 Mar 09 at 1:25 am

  47. The cookbook is an awesome idea, and putting it under CC is bold and generous of you. I had two big Flex 1.5 to Flex 2 migration projects in the past. Adobe has a migration guide doc out (very old by now), but the biggest issue I had was that there were quite a few things left out of the guide. Had I known I was going to have a second migration project I would have kept more thorough notes of each and every issue. Nonetheless, you might ask for contributions from developers who have worked on such projects…I’m sure there must be a lot. Also there are AS2 -> AS3 issues and then there are Flex framework migration issues, and then also there are issues dealing with versions of FDS/LiveCycle.
    here are some posts I made regarding the issues I found:
    http://blog.anaara.com/archives/date/2007/01

    there is also a link to the Adobe Migration Doc there,

    Fuad Kamak

    14 Mar 09 at 12:39 pm

  48. As a designer/programmer, I am now trying to migrate to AS3. I am jealous of the speed of the new AVM2, as well as all the cool libraries everybody is writing for AS3. Plus, I don’t want to get left behind eventually when AS2 is finally put to rest.

    It’s rough, though… going from being able to bend Flash to my will, to doing “Hello World” again.

    One of the things that I love about Flash, is the speed at which I can complete projects. My deadlines are always ridiculously short and I am responsible for all of the art, animation, and code for the project. Most are due in one or two days.

    I simply don’t have the time or patience to design a beautiful Class structure for these projects.

    I write all my code in the timeline, and I really like that all of my code as well as all of my assets are right there.

    A lot of developers think that timeline coders through code willy-nilly all over the place – place it on buttons, bury it deep into MovieClips, etc.

    That simply isn’t the case. Every timeline coder that I know works like this:

    All of my .swfs have just one frame. They generally have about 3 layers. The bottom layer is for the background elements, the middle layer is for the dynamic MovieClips that will be attached from the Library and get controlled by the code, and finally the top layer is where all the actionscript goes.

    The only code that ever gets “buried” is a stop(); script in some of the MovieClips with multiple frames.

    I would love to emulate this workflow in AS3. I’m also constantly building/tweaking both the code AND the graphics/animations at the same time. It’s so nice to test my .swf with Apple-Return. Tweak an animation then test. Tweak some code, then test. It’s such a nice responsive way to make quick adjustments.

    Anyway, so here are my questions about AS3 that I would love to understand:

    1. I love the idea of the Display List, but can I still place MovieClips on the Stage in the IDE? (I know I that can, but how do they fit in with the Display List?) Are they on a Display List? Can I move them up and down, swap them?

    2. Instance names. They way that I code, I kind of feel like an orchestra conductor. I have 50 MovieClips on the stage, and every one has a name. For example, I can tell my_mc19._alpha = 50; I can tell one movieclip to rotate to a certain angle and when that happens, tell another movieclip to move to a certain _x coordinate.

    Reading through the docs, it doesn’t seem like I can do this?
    It does seem like I can do this:
    var myMC:MovieClip = new MovieClip();
    myMC.x = 50;
    myMC.alpha = 80;
    this.addChild(myMC);

    So it seems like the variable name kind of like acts like an instance name?
    However, I am constantly attaching MovieClips in a for loop. How can I give them an instance name in that situation? I assume something like this?:

    for(var i = 0; i< 10; i++){
    var this["myMC" + i]:MovieClip = new MovieClip();
    this["myMC" + i].x = 50;
    this["myMC" + i].alpha = 80;
    this.addChild(this["myMC" + i]);
    }

    2b. Instance names that I type into the Property Inspector. If I drag an instance of a MovieClip onto the Stage, let’s say “score_mc”, and give it an instance name in the Property Inspector of “myScore”, can other MovieClips “talk” to it? None of the other MovieClips seem to have instance names anymore… Can other Movieclips still set myScore.text ?,

    Instance names in AS3 are definitely confusing to me, especially since that is a cornerstone of the way that I work. I’m used to everything having a name that I can reference. I know in AS3 there is the “name” property, but that just seems like a property, not a reference to the actual object itself. If anyone could clear that up for me, that would be a big help.

    3. Attaching and Removing MovieClips from the Library. Another cornerstone of my work process… I attach MovieClips to the Stage, give them a name, control them, and when I’m done, remove them. I know that removeMovieClip() is gone, what then is the way to do the above in AS3?

    4. Paths. Because I work in one frame on the timeline, _root is a very tangible concept to me. All of my functions are on the _root. If a MovieClip needs to call a global function, it can always call _root.myFunction();
    What is the concept of _root in AS3?

    4b. _parent. MovieClips can of course have nested MovieClips within them. i.e. myMC.myNestedMC. It is nice that I have an easy reference to the nested MovieClip’s _parent. That way if I do something like a Tween on the nested clip, when that Tween is over, I can remove that clip’s _parent.

    Those are the biggies for me:

    1. Display List in regards to items placed directly on the Stage in the IDE.
    2. Instance names and Instance names typed directly into the Properties Inspector
    3. Attaching and Removing MovieClips.
    4. _root and _parent.

    Also, if you are someone who is already writing Classes in AS2, I don’t think it will be too hard to migrate to AS3.

    I think that the actual truth is that most designer-coders are still using AS1. The ONLY thing that I personally use from AS2 is getNextHighestDepth();

    So you say that I can still use the Timeline, but if I can’t attach and remove MovieClips, and none of my MovieClips will have proper instance names so I can control them, I don’t really know how to start into AS3…

    And please know that I understand the beauty of Classes and OOP, I absolutely see the benefits for a big, complicated project, or for working with large teams, but I don’t work with any other programmers or artists, and my projects need to be completed and out the door usually in 6 hours or less.

    Sorry for the long post, thanks for listening.

    -Joe

    Joe Kauffman

    26 Mar 09 at 1:10 am

  49. so how does one do the equivalent of the, in AS3???

    for(var i = 0; i< 10; i++){
    var this["myMC" + i]:MovieClip = new MovieClip();
    this["myMC" + i].x = 50;
    this["myMC" + i].alpha = 80;
    this.addChild(this["myMC" + i]);
    }

    thanks

    David

    David Millner

    10 Dec 09 at 7:02 am

Leave a Reply