On 6/2/15, 11:40 AM, "Michael Schmalle" <teotigraphix...@gmail.com> wrote:

>On Tue, Jun 2, 2015 at 2:29 PM, Alex Harui <aha...@adobe.com> wrote:
>
>> Did I put the private vars in the constructor?  I could swear I got that
>> pattern from someone else.  I’m totally fine with changing it.  But we
>> have to take care of the "shared non-scalar initializer" scenario.
>>
>
>I vaguely remember this pattern and we used it in Randori, I know because
>I
>have a method that does just this in the RandoriEmitter.
>
>So what are all the scalar values in AS?

String, Int, Number, Uint, Boolean.  IIRC, it is anything you don’t “new”.
[] is effectively “new Array”, {} is effectively “new Object”.  And String
is in the list only because there is no in-place String modifiers.  And
you can’t just watch out for “new” as there can be static generators.

private var foo:SomeInstance = SomeSingleton.SomeInstanceFactory;

>
>I have to code to add this into the emitter when the time comes, so we
>need
>the prototype declaration but we also need to initalize files that
>initalize any value correct?

IIRC, in Flex in AS2 (not AS3) the convention was to declare all
variables/properties on the prototype, and initialize scalars on the
prototype and write code to initialize instance values in the constructor.
But feel free to do something else if it is easier.

-Alex

Reply via email to