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

On Wed, Sep 2, 2009 at 8:06 AM, Muzak<[email protected]> wrote:
> Works fine here:
>
> ClassA extends ClassC
> ClassB extends ClassC
> ClassC extends ClassD
> ClassD extends MovieClip
>
> // ClassA
> 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);
>  }
>  protected function moveUpHandler(event:Event):void {
>  trace("ClassA ::: moveUpHandler");
>  b = new ClassB();
>  trace("    - instance 'b': ", b);
>  }
> }
> }
>
> // ClassB
> package {
> public class ClassB extends ClassC {
>  public function ClassB():void {
>  trace("ClassB ::: CONSTRUCTOR");
>  }
> }
> }
>
> // ClassC
> package {
> public class ClassC extends ClassD {
>  public static const MOVE_UP:String = "moveUp";
>  public function ClassC():void {
>  trace("ClassC ::: CONSTRUCTOR");
>  }
> }
> }
>
> // ClassD
> package {
> import flash.display.MovieClip;
> public class ClassD extends MovieClip {
>  public function ClassD():void {
>  trace("ClassD ::: CONSTRUCTOR");
>  }
> }
> }
>
> In FLA:
>
> var a = new ClassA();
> trace("    - instance 'a': ", a);
> trace("    - disptaching MOVE_UP event on 'a'");
> a.dispatchEvent(new Event(ClassC.MOVE_UP));
>
>
> //Output
>
> ClassD ::: CONSTRUCTOR
> ClassC ::: CONSTRUCTOR
> ClassA ::: CONSTRUCTOR
>   - instance 'a':  [object ClassA]
>   - disptaching MOVE_UP event on 'a'
> ClassA ::: moveUpHandler
> ClassD ::: CONSTRUCTOR
> ClassC ::: CONSTRUCTOR
> ClassB ::: CONSTRUCTOR
>   - instance 'b':  [object ClassB]
>
>
> Exactly as expected. From what I can tell, it doesn't really matter which
> class extends which.
> The only thing that matters is that the MOVE_UP event handler
> (moveUpHandler) in ClassA gets called, which happens when I dispatch a
> MOVE_UP event on 'a' in the fla.
>
> regards,
> Muzak
>
> ----- Original Message ----- From: "Sajid Saiyed" <[email protected]>
> To: "Flash Coders List" <[email protected]>
> Sent: Tuesday, September 01, 2009 8:12 AM
> Subject: Re: [Flashcoders] Problem understanding Class heirarchy issue
>
>
>> Ok, Here is a bit more information.
>>
>> ClassA (works pefrectly fine):
>> -----------
>> package com.folder.subfolder
>> {
>>   import flash.display.*;
>>   import flash.events.*;
>>   import flash.filters.*;
>>   import flash.utils.Timer;
>>   import com.folder.subfolder.*;
>>
>>   public class ClassA extends ClassC
>> {
>>           public var myMenu: ClassB;
>>
>>           public function ClassA (){
>>                addEventListener(ClassC.moveUP, someFunction);
>>           }
>>           public function someFunction(){
>>                myMenu = new ClassB();
>> myMenu.name = "mymenu";
>> this.addChild(myMenu);
>>           }
>>
>>       }
>> }
>>
>> ClassB
>> -----------
>> package com.folder.subfolder
>> {
>>   import flash.display.*;
>>   import flash.events.*;
>>   import flash.filters.*;
>>   import flash.utils.Timer;
>>   import com.folder.subfolder.*;
>>
>>   public class ClassB extends ClassC
>> {
>>           public function ClassB (){
>>                // This is not getting called.....
>>           }
>>       }
>> }
>>
>>
>> Does this explanation help a bit??
>> Am I looking at the right place for the problem or the problem could
>> be somewhere else?
>>
>> Thanks
>> Sajid
>>
>>
>>
>>
>>
>> On Mon, Aug 31, 2009 at 10:46 PM, jonathan howe<[email protected]>
>> wrote:
>>>
>>> Are you defining a subclass constructor and then failing to explicitly
>>> call
>>> the super() (superclass's constructor)?
>>>
>>> On Mon, Aug 31, 2009 at 8:37 AM, Sajid Saiyed <[email protected]>
>>> wrote:
>>>
>>>> I am already importing all the classes in the package.
>>>>
>>>> Still cant seem to get my head around this.
>>>> Maybe later today I will post excerpts of my classes here.
>>>>
>>>> That might help.
>>>>
>>>> Regards
>>>> Sajid
>>>>
>>>> On Mon, Aug 31, 2009 at 6:14 PM, Cor<[email protected]> wrote:
>>>> > Not knowing what you are trying to do, you have to import ClassB to
>>>> > instantiate it in ClassA.
>>>> >
>>>> > HTH
>>>> > Cor
>>>> >
>>>> > -----Original Message-----
>>>> > From: [email protected]
>>>> > [mailto:[email protected]] On Behalf Of Sajid
>>>> Saiyed
>>>> > Sent: maandag 31 augustus 2009 12:06
>>>> > To: [email protected]
>>>> > Subject: [Flashcoders] Problem understanding Class heirarchy issue
>>>> >
>>>> > Hi,
>>>> > I have following Class structure:
>>>> >
>>>> > ClassA extends ClassC
>>>> >
>>>> > ClassB extends ClassC
>>>> >
>>>> > ClassC extends ClassD
>>>> >
>>>> > ClassD extends MovieClip
>>>> >
>>>> > Now,
>>>> > If I instantiate ClassB from ClassA, the constructor does not execute.
>>>> > note: Inside ClassB, I am instantiating another ClassE which extends
>>>> > MovieClip
>>>> >
>>>> > Is there something I am doing wrong?
>>>> > _______________________________________________
>>>> > Flashcoders mailing list
>>>> > [email protected]
>>>> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>> >
>>>> > _______________________________________________
>>>> > Flashcoders mailing list
>>>> > [email protected]
>>>> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>> >
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> [email protected]
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>
>>>
>>>
>>>
>>> --
>>> -jonathan howe
>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to