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/22 11:12:38 UTC

Making a private property public and testing

I'm trying to create a basic diagnostic tool that will show all Effects in
a UI Component class or all effect instances currently running but I'm
having trouble getting this information.

In the Effect Manager class there are two properties that would seem to
help:

mx_internal static var effectsPlaying:Array

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

The first looks like what I'm looking for but it, "Keeps track of all the
triggered effects that are currently playing." This doesn't help much since
I'm not working with trigger effects. BTW are they deprecated in Flex 4 or
was there not enough time to support them?

The second property contains the effects dictionary where each effect
registers themselves when they play but it is marked private. Is there
anyway to get this information?

Also, I created a local copy of EffectManager and marked the property
public. However, it's returning undefined and I'm not sure if that's
something I'm doing. I'm checking in the effect update event so it should
be in there.

Also, I added a method to get the effects dictionary but when I call that
method it throws an error, "getEffectsInEffect" is not a function. Is there
a rule to monkey patching I'm not aware of?


        public static function getEffectsInEffect():Dictionary
        {
            return effects;
        }

Re: Making a private property public and testing

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


On 6/22/12 2:12 AM, "jude" <fl...@gmail.com> wrote:

> I'm trying to create a basic diagnostic tool that will show all Effects in
> a UI Component class or all effect instances currently running but I'm
> having trouble getting this information.
> 
> In the Effect Manager class there are two properties that would seem to
> help:
> 
> mx_internal static var effectsPlaying:Array
> 
> private static var effects:Dictionary = new Dictionary(true);
> 
> The first looks like what I'm looking for but it, "Keeps track of all the
> triggered effects that are currently playing." This doesn't help much since
> I'm not working with trigger effects.
I think you probably want the Dictionary.
> BTW are they deprecated in Flex 4 or
> was there not enough time to support them?
I think not supporting event triggers was a purposeful decision but I don't
recall the logic behind it.
> 
> The second property contains the effects dictionary where each effect
> registers themselves when they play but it is marked private. Is there
> anyway to get this information?
No.  The dictionary and its access methods are there just to answer the
question if any effect is running at all.  It is used by Mustella.  You will
have to add an API to walk the dictionary if that's what you need.
> 
> Also, I created a local copy of EffectManager and marked the property
> public. However, it's returning undefined and I'm not sure if that's
> something I'm doing. I'm checking in the effect update event so it should
> be in there.
EffectManager.effects is returning undefined? That shouldn't be possible.

> 
> Also, I added a method to get the effects dictionary but when I call that
> method it throws an error, "getEffectsInEffect" is not a function. Is there
> a rule to monkey patching I'm not aware of?
> 
> 
>         public static function getEffectsInEffect():Dictionary
>         {
>             return effects;
>         }
I assume you've turned off RSLs? Otherwise you have to deploy fancier tricks
to inject a monkey-patch of a class in the framework RSL.

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