You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by jude <fl...@gmail.com> on 2012/06/24 13:44:28 UTC

[DISCUSS] Make EffectManager effects property public

Currently the EffectManager effects property is private. This property
shows what effects are in effect. Making this public will allow for
diagnostics.

EffectManager.as Line 869:

private static var effects:Dictionary = new Dictionary(true);

Re: [DISCUSS] Make EffectManager effects property public

Posted by jude <fl...@gmail.com>.
That's what I thought but it only contains trigger effects. The effects
dictionary contains effect instances that are registered in
mx.effects.EffectInstance startEffect() and then removed with the
finishEffect(). You can get the

    public function startEffect():void
    {
        EffectManager.effectStarted(this);
    }

The Effect class factory calls startEffect in it's play() method. It
doesn't have the effect and effectInstances that EffectNodes gives you but
if you have the effect instance it has a reference to the effect class.



On Sun, Jun 24, 2012 at 7:34 AM, Tink <fl...@tink.ws> wrote:

> Effects is a Dictionary that uses an effect as the key of an entry, and
> only ever uses 1 as the value of an entry.
>
> If you want to know what effects are playing, can't you use the
> mx_internal 'effectsPlaying' property? This is an array of EffectNodes (an
> internal class so you wouldn't be able to type to it), but each has a
> factory property for the Effect and an instance property for the
> EffectInstance.
>
> Tink
>
>
> On 24 Jun 2012, at 13:16, Justin Mclean wrote:
>
> > Hi,
> >
> >> Currently the EffectManager effects property is private. This property
> >> shows what effects are in effect. Making this public will allow for
> >> diagnostics.
> >
> > Probably adding a pubic getter would be a little safer? What do other
> people think?
> >
> > Justin
>
>

Re: [DISCUSS] Make EffectManager effects property public

Posted by Tink <fl...@tink.ws>.
Effects is a Dictionary that uses an effect as the key of an entry, and only ever uses 1 as the value of an entry.

If you want to know what effects are playing, can't you use the mx_internal 'effectsPlaying' property? This is an array of EffectNodes (an internal class so you wouldn't be able to type to it), but each has a factory property for the Effect and an instance property for the EffectInstance.

Tink

  
On 24 Jun 2012, at 13:16, Justin Mclean wrote:

> Hi,
> 
>> Currently the EffectManager effects property is private. This property
>> shows what effects are in effect. Making this public will allow for
>> diagnostics.
> 
> Probably adding a pubic getter would be a little safer? What do other people think?
> 
> Justin


Re: [DISCUSS] Make EffectManager effects property public

Posted by Alex Harui <ah...@adobe.com>.


On 6/25/12 10:06 AM, "Roland Zwaga" <ro...@stackandheap.com> wrote:

>> 
>> How much freedom do we have?
You have lots of freedom.  Often there is more than one way to solve a
problem and by being first to suggest a solution, you get to put a stake in
the ground, and I know I am less likely to want to change something that is
already coded vs some plan that hasn't been coded.

>> Marking it public is fine, using a getter is
>> fine, adding a setter is fine as well.
FWIW (and IMO), EffectManager also need to be refactored to use the "newer"
Singleton pattern (a static class that creates an impl instance that uses an
interface, e.g: StyleManager, CursorManager, etc).  This would mean that you
need getter/setter pairs instead of static var.
>> 
>> What about adding the effect instances to the effectsPlaying property on
>> EffectManager.effectStart() method? Would that have any adverse effect?
It would break any app relying on those properties only containing triggered
effects.
>> If
>> it did we could refactor effectsPlaying to triggerEffectsPlaying and use
>> effectsPlaying for normal effects (or normal and trigger) so the names
>> matche the descriptions.
Breaking backward compatibility is generally not a good idea, but there is
no strict policy against it.
>> 
>> We could also dispatch an effectStart and effectEnd event from the
>> EffectManager class. Doing both would solve the problem of tracking
>> effects.
>> 
> 
> Haha, now we'll enter into an interesting API discussion potentially ;)
> Exposing the
> insides of the framework is not always preferable because you open yourself
> up to modification that is not always wanted. (well, its never wanted I
> guess,
> open to extension, closed to modification, anyone?) Exposing certain
> innards might
> get you into trouble when evolving the SDK. Once you make something public
> its not
> easy to go back in a later version.
Exposing the specifics of an implementation is generally not good, so my
'test' is more about the semantics of the change.  IOW, would any effect
management implementation want to keep track of which effects are running?
I would say yes, and Mustella certainly needed it.  So it isn't an
implementation detail, it is part of a design that allows for
diagnostics/analysis.
> If the property really just needs to be public for tracking usage, then I
> believe what Jude
> suggest about dispatching an event sounds like an elegant solution to me...
> 
> Just my 2 cents...
> 
> Roland

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [DISCUSS] Make EffectManager effects property public

Posted by Roland Zwaga <ro...@stackandheap.com>.
>
> How much freedom do we have? Marking it public is fine, using a getter is
> fine, adding a setter is fine as well.
>
> What about adding the effect instances to the effectsPlaying property on
> EffectManager.effectStart() method? Would that have any adverse effect? If
> it did we could refactor effectsPlaying to triggerEffectsPlaying and use
> effectsPlaying for normal effects (or normal and trigger) so the names
> matche the descriptions.
>
> We could also dispatch an effectStart and effectEnd event from the
> EffectManager class. Doing both would solve the problem of tracking
> effects.
>

Haha, now we'll enter into an interesting API discussion potentially ;)
Exposing the
insides of the framework is not always preferable because you open yourself
up to modification that is not always wanted. (well, its never wanted I
guess,
open to extension, closed to modification, anyone?) Exposing certain
innards might
get you into trouble when evolving the SDK. Once you make something public
its not
easy to go back in a later version.
If the property really just needs to be public for tracking usage, then I
believe what Jude
suggest about dispatching an event sounds like an elegant solution to me...

Just my 2 cents...

Roland

Re: [DISCUSS] Make EffectManager effects property public

Posted by jude <fl...@gmail.com>.
How much freedom do we have? Marking it public is fine, using a getter is
fine, adding a setter is fine as well.

What about adding the effect instances to the effectsPlaying property on
EffectManager.effectStart() method? Would that have any adverse effect? If
it did we could refactor effectsPlaying to triggerEffectsPlaying and use
effectsPlaying for normal effects (or normal and trigger) so the names
matche the descriptions.

We could also dispatch an effectStart and effectEnd event from the
EffectManager class. Doing both would solve the problem of tracking
effects.

On Sun, Jun 24, 2012 at 7:33 AM, Justin Mclean <ju...@classsoftware.com>wrote:

> Hi,
>
> > Agreed, a read-only property sounds safer. Even though it would still
> allow
> > outside parties to add or remove keys.
>
> You could add a method/setter that makes a copy of the dictionary. The
> AdvancedDataGriud columns getter does this (array rather than dictionary
> but basically the same thing).
>
> Justin

Re: [DISCUSS] Make EffectManager effects property public

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> Agreed, a read-only property sounds safer. Even though it would still allow
> outside parties to add or remove keys.

You could add a method/setter that makes a copy of the dictionary. The AdvancedDataGriud columns getter does this (array rather than dictionary but basically the same thing).

Justin

Re: [DISCUSS] Make EffectManager effects property public

Posted by Roland Zwaga <ro...@stackandheap.com>.
>
> Hi,
>
> > Currently the EffectManager effects property is private. This property
> > shows what effects are in effect. Making this public will allow for
> > diagnostics.
>
> Probably adding a pubic getter would be a little safer? What do other
> people think?
>

Agreed, a read-only property sounds safer. Even though it would still allow
outside parties to
add or remove keys. I have no idea if this would be a bad thing
necessarily, I'd think not really...

Roland

Re: [DISCUSS] Make EffectManager effects property public

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> Currently the EffectManager effects property is private. This property
> shows what effects are in effect. Making this public will allow for
> diagnostics.

Probably adding a pubic getter would be a little safer? What do other people think?

Justin