ActionScript Example

Annotated Java Source File

You need to annotate the Java file at type level with the @ActionScript annotation. Use the @ActionScriptProperty annotation on method level.

    package de.aixcept.test.foo;

    @ActionScript( bindable = true, extendable = false )
    public class Foo {

        /** String Constant Comment */
        public static final String STRING_CONSTANT = "String Constant";

        /** Integer Constant Comment */
        public static final Integer INTEGER_CONSTANT = 42;

        /** Long Constant Comment */
        public static final Long LONG_CONSTANT = 42L;

        /** Double Constant Comment */
        public static final Double DOUBLE_CONSTANT = 12345.6789;

        private String foo = "My Foo Value";

        private Bar bar;


        /**
         * Method Comment for getFoo.
         * This is a multiline test comment.
         *
         * And another line...
         *
         * @return String
         */
        @ActionScriptProperty( bindable = true, defaultValue = true )
        public String getFoo() {
            return foo;
        }

        public void setFoo(String foo) {
            this.foo = foo;
        }


        @ActionScriptProperty(read = true, write = true)
        public Bar getBar() {
            return bar;
        }

        public void setBar(Bar bar) {
            this.bar = bar;
        }
    }

Resulting ActionScript3 Code

In order to make the generated code customizable, a Base class is generated on every build, but a user customizable class as well.

Extendable AS3 Code

This generated file can be user customized. This file is only generated, when not yet existant.

    /*
     * File: Foo.as
     *
     * Generated by Aixcept Flex Generator from de.aixcept.test.foo.Foo.
     *
     * NOTE:
     * This file is generated only if not existant.
     * You may safely add your custom implementation code here.
     */
    package de.aixcept.test.foo
    {
        /**
         * <code>Foo</code>
         */
        [Bindable] 
        [RemoteClass(alias="de.aixcept.test.foo.Foo")]
        public final class Foo extends FooBase
        {
        }
    }

Base AS3 Implementation Code

This file will be generated on every build. So you should not edit it in any case.

    /*
     * File: FooBase.as
     *
     * Generated by Aixcept Flex Generator from de.aixcept.test.foo.Foo
     *
     * WARNING:
     * DO NOT EDIT THIS FILE. CHANGE THE INHERITED CLASS Foo.as INSTEAD.
     * THIS ACTIONSCRIPT FILE IS AUTOGENERATED AND WILL BE OVERRIDDEN ON EVERY BUILD!!!
     */
    package de.aixcept.test.foo
    {
        import de.aixcept.test.Bar;

        /**
         * <code>Foo</code>
         */
        public class FooBase
        {

            /**
             * Integer Constant Comment
             */
            public static const INTEGER_CONSTANT : int = 42;

            /**
             * Double Constant Comment
             */
            public static const DOUBLE_CONSTANT : Number = 12345.6789;

            /**
             * String Constant Comment
             */
            public static const STRING_CONSTANT : String = "String Constant";

            /**
             * Long Constant Comment
             */
            public static const LONG_CONSTANT : Number = 42;

            private var _bar : Bar;

            /**
             * Method Comment for getFoo.
             * This is a multiline test comment.
             *
             * And another line...
             */
            [Bindable]
            public var foo : String = "My Foo Value";

            /**
             * Default constructor for FooBase.
             */
            public function FooBase()
            {
            }

            /**
             * Sets the bar property.
             */
            public function set bar( value : Bar ) : void
            {
                _bar = value;
            }

            /**
             * Returns the bar property value.
             */
            public function get bar() : Bar
            {
                return _bar;
            }
        }
    }