Meanwhile, I would like to say that, I am not writing anything in my FLA.
(I guess thats the best practice, is it correct?)

Yup, that's correct.

So, ONlything I do in the FLA is declare ClassA as my document root class.
Could that be the problem?

Nope. I modified ClassA and made it the document class:

package {
import flash.events.Event;
public class ClassA extends ClassC {
 public var b:ClassB;
 public function ClassA():void {
  trace("ClassA ::: CONSTRUCTOR");
  addEventListener(ClassC.MOVE_UP, moveUpHandler);
  trace("    - disptaching MOVE_UP event");
  dispatchEvent(new Event(ClassC.MOVE_UP));
 }
protected function moveUpHandler(event:Event):void {
  trace("ClassA ::: moveUpHandler");
  b = new ClassB();
  addChild(b);
  trace("    - instance 'b': ", b);
 }
}
}

//Output
ClassD ::: CONSTRUCTOR
ClassC ::: CONSTRUCTOR
ClassA ::: CONSTRUCTOR
   - disptaching MOVE_UP event
ClassA ::: moveUpHandler
ClassD ::: CONSTRUCTOR
ClassC ::: CONSTRUCTOR
ClassB ::: CONSTRUCTOR
   - instance 'b':  [object ClassB]

As you can see, the last line in the output is the trace() after instantiating 
ClassB.

In your initial question you said:
If I instantiate ClassB from ClassA, the constructor does not execute.

How are you determining that? Cos now you're saying that a trace() in ClassA is not displaying any output when creating an instance of ClassB.

Are you sure there are no errors in the Compiler Errors window?
What does ClassB look like?

regards,
Muzak

----- Original Message ----- From: "Sajid Saiyed" <sajid.fl...@gmail.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, September 02, 2009 4:07 AM
Subject: Re: [Flashcoders] Problem understanding Class heirarchy issue


Hi,
Thanks all of you for adding your valuable inputs, I am reviewing all
suggestions.

Meanwhile, I would like to say that, I am not writing anything in my FLA.
(I guess thats the best practice, is it correct?)

So, ONlything I do in the FLA is declare ClassA as my document root class.

Could that be the problem?

Also the trace in my "someFunction" is getting called.
Then immediately after the trace, I have the code to instantiate ClassB.
The trace immediately after this instantiation does not appear.

Regards
Sajid


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to