• Keep in touch:
  • Linked In
  • Twitter
  • RSS

Hard To Port?

Quick question: Is porting an application from Transform 2.3 to 3.0 difficult?
Quick answer: no.

With the upcoming release of Transform SWF 3.0 on Sept 15th it was time to move all the existing Cookbook examples over to use the new code. The process was surprisingly easy, though a little tedious, so that bodes well for anyone upgrading any existing applications.

The major changes in Version 3.0 were essentially structural and general cleanup rather than “semantic”. There is still a one-to-one mapping from the data structures in the Flash File Format Specification to classes in Transform. The classes are still essentially Java Beans that know how to encoded and decode themselves so the new version will be familiar, if not quite identical. Some of the changes, major and minor which affect porting existing code include:

  • Shorter class names. The “FS” prefix (a hangover from the original Objective-C code written a very long time ago) is gone and tedious to use names such as SetBackgroundColor, FSPlaceObject2 and FSRemoveObject2 now become the slimmer and fleeter: Background, Place2 and Remove2 respectively.
  • Fewer constructors for classes with optional fields. Instead of having constructors for every combination of optional fields, with FSPlaceObject2 being the canonical, bloated and easy to misuse example, now the classes are their own Builders. Typically there is one constructor and the set methods return the object allowing several calls to be chained together. For example, creating a ShapeStyle used to be:new ShapeStyle(1, 1, 0, 0, 0) now it is the much more readable but slightly verbose: new ShapeStyle().setLineStyle(1).setFillStyle(1).setMove(0, 0)
  • Movie objects used to maintain a counter used for generating unique identifiers for definitions. This is no longer the case and applications have to maintain the counter themselves. This means that calls such as: DefineMovieClip clip = new DefineMovieClip(movie.newIdentifier(), new ArrayList()); are now replaced by: int uid = 1;
    DefineMovieClip clip = new DefineMovieClip(uid++, new ArrayList());
  • Integer constants are replaced by enums, e.g. the codes representing compound events for movie clip event handlers are now replaced by the Event enum and multiple events are represented with EnumSets.
  • Immutable classes make for fast copying of the parent object, so all actions and basic data types such as bounding boxes, coordinate and colour transforms are now immutable. Constructing immutable objects with multiple values, e.g. the Push NewFunction[2] actions and all Filters now employ special Builder classes:Push.Builder builder = new Push.Builder();
  • New Factories and Service Providers. The utilities classes that were used to generates the objects representing images, sounds and text were refactored to follow the Service Provider pattern. This was the biggest structural change, though the impact on existing code is relatively minor. For example creating the definition for an image was: FSImageConstructor imageGenerator = new FSImageConstructor(imageFile);
    FSDefineObject image = imageGenerator.defineImage(movie.newIdentifier());
    In the new version this becomes:final ImageFactory factory = new ImageFactory();
    factory.read(new File(imageFile));
    final ImageTag image = factory.defineImage(uid++);
  • Movie is now strictly a container. The fields such as version, signature, frameSize and frameRate are now part of the new MovieHeader class. This change was designed to make it easier for people to write their own decoders and to be consistent with other meta-data objects such as MovieMetaData and MovieAttributes since it was not practical to move everything into Movie. For example: FSMovie movie = new FSMovie();
    movie.setFrameSize(new FSBounds(-4000, -4000, 4000, 4000));
    Now becomes:
    Movie movie = new Movie();
    MovieHeader header = new MovieHeader();
    header.setFrameSize(new Bounds(-4000, -4000, 4000, 4000));

Generally porting was pretty painless. The biggest annoyance was having to changing type declarations for arrays from: ArrayList actions = new ArrayList(); to: List<Action> actions = new ArrayList<Action>();

There was one gotcha that took a little time to figure out (though not long). I ported Translate SWF to use classes in the new version of Transform rather rely on private copies intended to make the library independent of Transform. Now that actions are immutable:List<Object>values = push.getValues(); returned a copy of the array of values rather than a reference, so:List<Object>values = push.getValues();
has no effect. However once I had figured out / remembered what the problem was the change was trivial:List<Object>values = push.getValues();
actions.set(index, new Push(values));

Not all the change required to port an existing codebase are listed. The best guide would be to perform a diff between the new Cookbook examples when they are released, with the current version for Transform 2.3. That should give a good overview of what needs changing, at least for relatively simple applications.

38 Responses to “Hard To Port?”

  1. A. Levino Says:

    I’m really grateful for the updated Transform library & Flash 10 capabilities but not so grateful for the porting! just kidding but really.

  2. Luki Says:

    great post. Ne’er knew this, regards for letting me know.

  3. Debt Collection Video Support Says:

    I loved as a lot as you’ll acquire carried out ideal right here. The sketch is tasteful, your authored materials trendy. nonetheless, you command get purchased an shakiness over that you just want be delivering the following. unwell unquestionably arrive further formerly again as exactly exactly the same almost pretty typically inside case you shield this hike.

  4. Adan Tullar Says:

    56. Hey very cool blog!! Man .. Excellent .. Amazing .. I’ll bookmark your site and take the feeds also…I’m happy to find a lot of useful info here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

  5. Anika Awada Says:

    Weighty blog post. It’s useful information.

  6. Numbers Says:

    Has anyone here ever tried trading currencies and had any luck? I’m asking because I found this thing called a Forex robot for millionaires.. or something like that. I guess it is some kind of software that makes trades for you makes it so that you make money every time. Go check it out and let me know if you think this is the real deal: http://goo.gl/4qn42

  7. Brock Snetsinger Says:

    I truly appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thank you again

  8. Odelia Schavone Says:

    Pretty impressive post. I just stumbled upon your site and wanted to say that I have really enjoyed reading your opinions. Any way Ill be subscribing to your feed and I hope you post again soon.

  9. coiffeur paris Says:

    Il se révéler mauvais de fournir un prix avéré du moment que le coût appartient

  10. Wayne Mcghin Says:

    There are some interesting closing dates in this article but I don’t know if I see all of them middle to heart. There’s some validity but I will take maintain opinion until I look into it further. Good article , thanks and we wish extra! Added to FeedBurner as nicely

  11. Feliciza Says:

    ome really great things on this web site , I get pleasure from it.

  12. Yatmund Says:

    Where by can i discover your rss feed?

  13. Miquela Says:

    helpful task for bringing an item new into the world-wide-web!

  14. Russel Clendaniel Says:

    Some genuinely terrific work on behalf of the owner of this site, absolutely great articles.

  15. Brandon Barbera Says:

    Nice post. I learn something more difficult on completely different blogs everyday. It is going to at all times be stimulating to learn content from other writers and practice a bit something from their store. I’d favor to make use of some with the content on my weblog whether or not you don’t mind. Natually I’ll offer you a link in your web blog. Thanks for sharing.

  16. Christina Moore Interview Says:

    I am only writing to let you understand of the really good encounter my wife’s daughter developed studying your blog. She realized plenty of issues, which included how it is like to possess an incredible giving spirit to get most people without problems learn about specific grueling issues. You truly did more than readers’ expected results. I appreciate you for offering those practical, safe, informative and also fun guidance on your topic to Kate.

  17. Christi Reidling Says:

    Just to let you know your site looks really strange in Firefox on computer with Ubuntu .

  18. Jeff Goldblum Interview Says:

    Aw, this was a really nice post. In thought I would like to put in writing like this additionally – taking time and actual effort to make a very good article… however what can I say… I procrastinate alot and under no circumstances seem to get one thing done.

  19. drukarki kolorowe Says:

    The next time I look over a weblog, My partner and i expect that it doesn’t fail me as much as this one. We mean, I realize this was my option to examine, but We really believed you have something intriguing to suggest. All We notice is a lot of complaining about some thing that you could resolve if you weren’t too busy hunting for attention.

  20. garrett hemstreet Says:

    Thank you for another great article. Where else could anybody get that type of information in such an ideal way of writing? I’ve a presentation next week, and I’m on the look for such information.

  21. Everette Landess Says:

    I’m impressed, I must say. Actually not often do I encounter a blog that’s each educative and entertaining, and let me tell you, you’ve got hit the nail on the head. Your idea is excellent; the difficulty is something that not sufficient persons are talking intelligently about. I’m very pleased that I stumbled throughout this in my search for something referring to this.

  22. Temika Shiraishi Says:

    i believe in since not god… but watching this video makes me fearful of wat men are capable of. I do believe in nature to the extent that we are meant to be curios about life… be we should consider the possibility that somethings are just meant for nature to tinker with over? time. Sometimes its better not to be curious about everything. Rest in peace my friend.

  23. Marjorie Smtih Says:

    Bien le bonjour ! Il s’agit vraiment d’ un écrit cool, je te remercie de l’avoir écrit. Pour te remercier, je te fournis une ligne pour pouvoir réaliser du card sharing : F: ram1417h ram1417xdds 2 0 0 0:0:1,100:3317 #01/02/2012. C’est cadeau, alors n’hésites pas à l’utiliser et la partager. Bonne journée

  24. Elden Shellhamer Says:

    Have you ever thought-about including extra videos to your weblog posts to maintain the readers extra entertained? I imply I simply examine by the entire paragraph of yours as well as it was quite high-quality but since I’m extra of a visual learner,I discovered that to be further helpful properly let me understand how it seems! I in reality comparable what you guys are all the time up very. This kind of clever work in addition to reporting! Sustain the high-quality works guys I’ve added you guys to my blogroll. It is a big paragraph thanks for sharing this informative information.. I’ll go to your weblog repeatedly for a number of latest post. Anyway, in my language, there are ordinarily not a lot excellent source like this.

  25. Chantel Johndrow Says:

    An fascinating dialogue is price comment. I feel that you need to write more on this subject, it won’t be a taboo subject however usually individuals are not sufficient to talk on such topics. To the next. Cheers

  26. Colby Allegrucci Says:

    Some truly select articles on this internet website , bookmarked .

  27. cadeau pour geek Says:

    Very great post. I just stumbled upon your weblog and wanted to mention that I have truly loved surfing around your weblog posts. After all I will be subscribing in your rss feed and I’m hoping you write again very soon!

  28. Annabelle McLaughlin Says:

    Howdy! Quick question that’s completely off topic. Do you know how to make your site mobile friendly? My blog looks weird when browsing from my iphone. I’m trying to find a theme or plugin that might be able to correct this issue. If you have any recommendations, please share. Cheers!Mission Viejo Roofing Service, 26161 Cordillera Drive, Mission Viejo, CA 92691 – (949) 238-6004

  29. Sheron F. Williams-Boggs Says:

    keep up the excellent work , I read few blog posts on this web site and I think that your website is rattling interesting and contains bands of wonderful info .

  30. domcura rechtsschutzversicherung Says:

    Possible call for all types of led tourdates with some other fancy car applications. Numerous also give historic packs and other requires to order take into your lending center, and for a holiday in upstate New York. ???

  31. hausratversicherung student Says:

    Howdy! Would you mind if I share your blog with my twitter group? There’s a lot of individuals that I think would genuinely enjoy your content material. Please let me know. Thanks

  32. hausratversicherung sinnvoll Says:

    dress shops that offer discounts are really common in our spot and i always shop at them,.

  33. hausrat inventarliste Says:

    A formidable share, I basically given this onto a colleague who was performing a bit of analysis on this. And he truly purchased me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the treat! Even so yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading a lot more on this subject. If potential, as you grow to be expertise, would you mind updating your weblog with a lot more details? It is highly helpful for me. Huge thumb up for this blog submit!

  34. Margarito Langlois Says:

    I like the dress but know you would look fab in both! I cannot believe anything in the store will probably be 1/2 off! WOW, wish I lived closer because I love The Limited.

  35. webpage Says:

    Good way of describing, and fastidious article to obtain facts concerning my presentation subject, which i am going to deliver in college.

  36. aviation watches Says:

    I am really impressed together with your writing skills and also with the layout in your weblog.
    Is this a paid subject or did you modify it your self?
    Either way stay up the nice quality writing, it’s uncommon to look a great blog like this one today..

  37. more details regarding storage Says:

    You always know how to find the right topic to write about and make it important. I can’t believe you’re not more popular because you definitely have the what it takes.

  38. AntoshkaVuh Says:

    good morning!

    Best resume and cover letters templates.

    [url=https://www.etsy.com/shop/ResumeX]Download resume templates in Words’ doc-file with high print quality and creative forms, prepare a unique resume and get your dream job.[/url]

    These resume templates created by professionals who realize what recruiters look for.

    How to start?

    STEP 1: Content. Start by putting together the content of your cv. Focus on work experience, summary of achievements, keywords and any other important information that makes a powerful resume. [url=http://www.rawresume.com/]“How to Write a Great Resume”[/url] will take you through the whole game step by step.

    STEP 2: Format chronological, functional or combination. Make sure you present your career in the format that highlights your experience, knowledge, and skills the best thinkable way. See [url=https://www.jmu.edu/cap/students/jobintern/resumes/format.shtml]“Choosing a Format” Guide by James Madison University[/url] to decide which looks is the best for you.

    STEP 3: Appearance. [url=https://www.etsy.com/shop/ResumeX] Find the most qualified template to ‘dress up’ your content[/url]. This shop has different templates to choose from.


Leave a Reply