Ted Patrick > { Events & Community } > Adobe Systems


While putting together a custom Preloader for Flex 2 I generated an ActionScript 3 Class using Flex Builder. I decided to explore the Add/Remove Interfaces feature in the New ActionScript Dialog. OMG, this is such an awesome feature, I am speechless.

For every Interface you add to your new class, Flex Builder will add all the methods the Interface needs with correct input and return types instantly. I didn't really know what to expect but this far exceeded my expectations.



Try this:

1. Open Flex Builder
2. Create New Flex Project
3. Create New AS Class
4. Enter Class Name
5. Enter "flash.display.Sprite" for the SuperClass
6. Enter "mx.preloaders.IPreloaderDisplay"
7. Make sure that 'Generate functions inherited from Interface' is checked.


Bingo! A perfect custom preloader AS3 Class, ready for deep customization. Rockin!

I love automation, don't make me think, save me boatloads of time, and works perfectly every single time! Great work Flex Builder Team, this one is a jewel.

Custom Preloaders are loading...

Cheers,

Ted :)

3 Responses to “ Generating Custom Classes with Interfaces in Flex Builder ”

  1. # Anonymous Brandon Ellis

    That's awesome. :)
    It's so great to see ActionScript maturing into such a great language. Now if they would just drop the name if favor of something that doesn't have 'Script' in it. How about 'F+' or 'Flash+'?  

  2. # Anonymous Alex Muntean

    It looks like you've never used Eclipse (or something built on top of it) before ;)

    To tell you the truth I was also pleasantly surprised by those wizards :)

    Now if the next FB2 update will integrate it with Eclipse 3.2 - and allow us to customize the generated code - everything will be perfect :)  

  3. # Blogger hassan

    1137: Incorrect number of arguments. Expected no more than 1

    ---------------------------------

    I create the following function

    ---------------------------------

    package com.cerebrum.utils {

    import mx.rpc.events.ResultEvent
    import mx.controls.Alert;

    public class Result {

    [Embed("/assets/images/dialog-information.png")]
    public var IconDialogInformation:Class;

    public function Result(event:ResultEvent,MyObject:Object):void {
    Alert.show("teste", "teste", 4, null, null, IconDialogInformation);

    }
    }
    }

    ---------------------------------

    I as follows

    import Result;

    Result(event, meuobjeto);

    ---------------------------------

    Is presented in the following error flex builder

    1137: Incorrect number of arguments. Expected no more than 1.

    ---------------------------------

    How should I inform the function that actually has 2 parameters?  

Post a Comment



Jobs


Flex Jobs
city, state, zip


© 2008 Ted On Flash