Reputation: 11
1.Is there any way to access the private data members of a class in action script using asmock framework? I tried using syntax like
ContentPlayer[“getContentPlayer”]=mockContentPlayer;
Where in getContentPlayer is a private member and mockContentPlayer is alias am creating, but its not working well, I doubt whether I can do like this?
Upvotes: 1
Views: 592
Reputation: 84754
asMock uses inheritance to intercept calls to the methods. As it's not possible to override a static or private method in the AVM, it's not possible for asMock to add support for it.
I'd recommend abstracting the static call with an interface and accepting an instance in the constructor.
Upvotes: 1
Reputation: 1007
You can't access private fields from outside of class in AS3. Period.
Upvotes: 0