AS3: Really weird “inaccessable” error when referencing document root object?

In the event that my comment is buried, I'll formalize it as a response.

In the event that my comment is buried, I'll formalize it as a response: Get rid of the static class reference and the quasi-singleton style access to your document class. Instead, use dependency injection like this: public function PClient() { // Trace trace("Client(): Client initiated"); // Create session handler/loader _sessionLoader = new PSessionLoader(this); // Create command loader _cmdLoader = new PCommandLoader(this); ... addChild(_guiLoader); // Call on start onStart(); } Rewrite your classes like PCommandLoader to construct with a reference to a PClient, or use an interface reference to pass in PClient's public interface. Or, do this: _cmdLoader = new PCommandLoader(); _cmdLoader.

Init(this); Again, "this" is a reference to your document class object, but it need not be a PClient type variable, it could (arguably should) be an interface type. It sounds like you've tried this approach, but without seeing the resulting code, it's difficult to be sure you've done exactly what I expect. I would not expect the 1195 error to persist with this approach, since I do it all the time.

I had tried that. I got the same errors when I referenced the stored PClient object from passing this. :P But yea like I said adding/removing dynamic on the class magically fixed it.

– Di-0xide Apr 28 at 6:17 That's great, but it's not a fix I'd be satisfied with. Nothing about software development is magic; when you don't understand the problem, or the nature of the fix, these sort of bugs tend to come back to haunt you, usually in the 11th hour :-/ I can tell you right now that there should be no problem with passing 'this', and nothing in your code needs the dynamic keyword, which means using it is only suppressing some manner of compile time type/class path checks. Very unsettling to me!

I'd consider the 'dynamic' thing a clue, not a fix. Check for package hierarchy/namespace weirdness. – Adam Smith Apr 28 at 13:21 I know, I said setting dynamic fixed it, then to test if that was really the solution, I took it out expecting the error to return.It didn't -__- It might have been a weird project caching fluke, I'm not sure.

I know nothing in programming is "magic" haha, just one of those things. – Di-0xide Apr 29 at 5:35.

GetSessionHandler method is not defined as static public static function getSessionHandler():PSessionLoader This also explains why strict mode off compiles EDIT try this. Private static var instance:PClient; public static function getInstance():PClient{ if (instance == null) { instance = new PCLient(new PClient()); } return instance; }.

I've tried it with static. It spits out: C:\Pim Online\V2\lib\pim\loader\PCommandLoader. As, Line 149 1061: Call to a possibly undefined method getSessionHandler through a reference with static type pim:PClient.

– Di-0xide Apr 22 at 22:43 That's the strange thing about this error. – Di-0xide Apr 22 at 22:43 When you are accessing PClient you are refering to it as a singleton. If you want to do it that way you need to set up the class with static everything.Is there a reason you are using this class as a singleton?

Why not just rewrite it as a normal class? – The_asMan Apr 23 at 1:38 It's not a true singleton."This" references that particular instance. I'm referencing it through a static member; however, that static member stores the reference to the original object (instance).

As you can see, none of these members are static other than the method that gets the instance.It's not a "singleton" class, it's just my way of getting it to reference that one instance. – Di-0xide Apr 23 at 3:40 The bizarre thing is that even when I take out all of the static stuff and literally pass this to each loader and the loader storing it, and then using that stored instance in the classes, I still get the "inaccessible members" error. – Di-0xide Apr 23 at 3:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions