Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-02 Thread Steven Sacks

You're right. I'm wrong. Sajid is doing something else incorrectly.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-02 Thread Muzak

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" 

To: "Flash Coders List" 
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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-02 Thread Ian Thomas
I'm sorry, Steven, that's just not true. Test out the following code:

package
{
public class A
{
public function A()
{
trace("A Constructor");
}
}
}

package
{
public class B extends A
{
public function B()
{
trace("B Constructor");
}
}
}

and create an instance of B, and you will see:

"A Constructor"
"B Constructor"

in the debug window.

You only explicitly need to specify the super() call to pass arguments
to your superclass's constructor.

(I've _never_ used empty super() calls, and all my code still works -
all my superclass constructors still get called...)

Ian

On Tue, Sep 1, 2009 at 11:56 PM, Steven Sacks wrote:
> In AS2, super() was called automatically (so to speak), so calling it was a
> matter of proper form more than anything else.  In AS3, you have to call it
> yourself or it doesn't get called.
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Sajid Saiyed
Hi,
In ClassA, the someFunction definition is:

public function someFunction(){
trace(this, "Some function called");
objectB = new ClassB();
objectB.name = "myobjectB";
this.addChild(objectB);
trace(this, "This is not getting called");
}

Regards
Sajid

On Wed, Sep 2, 2009 at 10:07 AM, Sajid Saiyed wrote:
> 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 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" 
>> To: "Flash Coders List" 
>> 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.displ

Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Sajid Saiyed
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 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" 
> To: "Flash Coders List" 
> 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
>> 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 
>>&

Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Muzak

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" 

To: "Flash Coders List" 
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 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  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 wrote:
> Not knowing what you are trying to do, you have to import ClassB to
> instantiate it in ClassA.
>
> HTH
> Cor
>
> -Original Message-
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sajid
Saiyed
> Sent: maandag 31 augustus 2009 12:06
> To: flashcoders@chattyfig.figleaf.com
> 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
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig

Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Muzak

AKAIK, a constructor is always invoked when an instance is created and there's 
no way around that.
So if you have some trace() actions in the contstructor of ClassB and you don't 
see the output, no instance is created.
Which in this case probably means that someFunction() is not being invoked.

When is the moveUP event dispatched?

regards,
Muzak

- Original Message - 
From: "Sajid Saiyed" 

To: "Flash Coders List" 
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


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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Muzak

Are you talking about something like this??

package {
public class ClassA {
 public function ClassA():void {
  trace("ClassA ::: CONSTRUCTOR");
 }
}
}

package {
public class ClassB extends ClassA {
 public function ClassB():void {
  trace("ClassB ::: CONSTRUCTOR");
 }
}
}

// in fla
var b:ClassB = new ClassB();

// output
ClassA ::: CONSTRUCTOR
ClassB ::: CONSTRUCTOR

There's no need to call super() in the constructor.
Or are you talking about something else?

regards,
Muzak

- Original Message - 
From: "Steven Sacks" 

To: "Flash Coders List" 
Sent: Wednesday, September 02, 2009 12:56 AM
Subject: Re: [Flashcoders] Problem understanding Class heirarchy issue


In AS2, super() was called automatically (so to speak), so calling it was a 
matter of proper form more than anything else.  In AS3, you have to call it 
yourself or it doesn't get called.

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


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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Steven Sacks
In AS2, super() was called automatically (so to speak), so calling it was a 
matter of proper form more than anything else.  In AS3, you have to call it 
yourself or it doesn't get called.

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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Matt Gitchell
super(arg:AnyApplicableArgument) calls the constructor of the parent class,
in this case all the stuff that happens in function ClassB(){...}

On Tue, Sep 1, 2009 at 8:23 AM, Sajid Saiyed  wrote:

> yes, someFunction is getting called.
> If I change ClassB to:
> 
> public class ClassB extends MovieClip
> or
> public class ClassB extends Sprite
> 
> Then the constructor gets called.
>
> I still have to try super() as suggested by Steven (I am at home now
> so dont have the code with me)
> So Steven,
> Do youmean that I just add "super()" in the first line of ClassA
> constructor?
>
> Regards
> Sajid
>
> On Tue, Sep 1, 2009 at 11:03 PM, Jim Lafser wrote:
> > Have you verified that someFunciton is getting called?
> > Is someFunction getting called in the scope that you expect?
> > May need to use:
> > addEventListener(ClassC.moveUP, Delegate.create(this, someFunction);
> > to get someFunciton to run in the scope that you expect.
> >
> > --- On Tue, 9/1/09, Steven Sacks  wrote:
> >
> >
> > From: Steven Sacks 
> > Subject: Re: [Flashcoders] Problem understanding Class heirarchy issue
> > To: "Flash Coders List" 
> > Date: Tuesday, September 1, 2009, 9:11 AM
> >
> >
> > You're not calling super() in the ClassA constructor.
> >
> >
> > On Aug 31, 2009, at 11:12 PM, Sajid Saiyed wrote:
> >
> >> 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
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
> >
> >
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Sajid Saiyed
yes, someFunction is getting called.
If I change ClassB to:

public class ClassB extends MovieClip
or
public class ClassB extends Sprite

Then the constructor gets called.

I still have to try super() as suggested by Steven (I am at home now
so dont have the code with me)
So Steven,
Do youmean that I just add "super()" in the first line of ClassA constructor?

Regards
Sajid

On Tue, Sep 1, 2009 at 11:03 PM, Jim Lafser wrote:
> Have you verified that someFunciton is getting called?
> Is someFunction getting called in the scope that you expect?
> May need to use:
>     addEventListener(ClassC.moveUP, Delegate.create(this, someFunction);
> to get someFunciton to run in the scope that you expect.
>
> --- On Tue, 9/1/09, Steven Sacks  wrote:
>
>
> From: Steven Sacks 
> Subject: Re: [Flashcoders] Problem understanding Class heirarchy issue
> To: "Flash Coders List" 
> Date: Tuesday, September 1, 2009, 9:11 AM
>
>
> You're not calling super() in the ClassA constructor.
>
>
> On Aug 31, 2009, at 11:12 PM, Sajid Saiyed wrote:
>
>> 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
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Jim Lafser
Have you verified that someFunciton is getting called?
Is someFunction getting called in the scope that you expect?
May need to use:
    addEventListener(ClassC.moveUP, Delegate.create(this, someFunction); 
to get someFunciton to run in the scope that you expect.

--- On Tue, 9/1/09, Steven Sacks  wrote:


From: Steven Sacks 
Subject: Re: [Flashcoders] Problem understanding Class heirarchy issue
To: "Flash Coders List" 
Date: Tuesday, September 1, 2009, 9:11 AM


You're not calling super() in the ClassA constructor.


On Aug 31, 2009, at 11:12 PM, Sajid Saiyed wrote:

> 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
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-09-01 Thread Steven Sacks

You're not calling super() in the ClassA constructor.


On Aug 31, 2009, at 11:12 PM, Sajid Saiyed wrote:


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

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


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-08-31 Thread Sajid Saiyed
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 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  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 wrote:
>> > Not knowing what you are trying to do, you have to import ClassB to
>> > instantiate it in ClassA.
>> >
>> > HTH
>> > Cor
>> >
>> > -Original Message-
>> > From: flashcoders-boun...@chattyfig.figleaf.com
>> > [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sajid
>> Saiyed
>> > Sent: maandag 31 augustus 2009 12:06
>> > To: flashcoders@chattyfig.figleaf.com
>> > 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
>> > Flashcoders@chattyfig.figleaf.com
>> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> >
>> > ___
>> > Flashcoders mailing list
>> > Flashcoders@chattyfig.figleaf.com
>> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> >
>> ___
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
>
> --
> -jonathan howe
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-08-31 Thread jonathan howe
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  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 wrote:
> > Not knowing what you are trying to do, you have to import ClassB to
> > instantiate it in ClassA.
> >
> > HTH
> > Cor
> >
> > -Original Message-
> > From: flashcoders-boun...@chattyfig.figleaf.com
> > [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sajid
> Saiyed
> > Sent: maandag 31 augustus 2009 12:06
> > To: flashcoders@chattyfig.figleaf.com
> > 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
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem understanding Class heirarchy issue

2009-08-31 Thread Sajid Saiyed
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 wrote:
> Not knowing what you are trying to do, you have to import ClassB to
> instantiate it in ClassA.
>
> HTH
> Cor
>
> -Original Message-
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sajid Saiyed
> Sent: maandag 31 augustus 2009 12:06
> To: flashcoders@chattyfig.figleaf.com
> 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
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Problem understanding Class heirarchy issue

2009-08-31 Thread Cor
When you do ClassA extends ClassC
you should read this as ClassA "is a" ClassC and in him you extend its
functionality


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sajid Saiyed
Sent: maandag 31 augustus 2009 12:06
To: flashcoders@chattyfig.figleaf.com
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


[Flashcoders] Problem understanding Class heirarchy issue

2009-08-31 Thread Sajid Saiyed
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Problem understanding Class heirarchy issue

2009-08-31 Thread Cor
Not knowing what you are trying to do, you have to import ClassB to
instantiate it in ClassA.

HTH
Cor

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sajid Saiyed
Sent: maandag 31 augustus 2009 12:06
To: flashcoders@chattyfig.figleaf.com
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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