You've got yourself a cyclic dependency there.
I'm surprised it runs at all.

var a:FirstClass = new FirstClass();

// construction calls
--> FirstClass (which creates)
---> SecondClass (which creates)
----> FirstClass  (which creates)
------> SecondClass (which creates)
-------> etc, etc, etc (which creates)

An object can never be a child 
of itself in a container hierarchy.

I don't believe I've ever had a need
for something like this in 20 years
of programming.

Don't use new SomeClass, pass a reference
of each class to the other or if they
are instances of different classes 
make them implement an interface and
pass that around or you will get cyclic
include issues.

~neo


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 29 June 2006 11:11 AM
To: [email protected]
Subject: [Flashcoders] Q:2 Way Comunication between classes

I have 2 menus systems that I need to establish communication between.

Each menu system is controlled by a class that uses EventDispatcher to keep
track of which button is currently selected.

The problem is when I try to establish 2 WAY communication between these 2
menu classes.

I can use composition to communicate ONE way, but when I try and reference
each class from the other, I get some pretty funky things happening! I think
its because its a many to many relationship...


//FIRST CLASS

//constructor
function FirstClass(){
var sc= new SecondClass()
}



//SECOND CLASS

//constructor
function SecondClass(){
var fd= new FirstClass()
}


Any suggestions appreciated!

Jim Bachalo

[e] jbach at bitstream.ca
[c] 416.668.0034
[w] www.bitstream.ca
--------------------------------------------
"...all improvisation is life in search of a style."
             - Bruce Mau,'LifeStyle'
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to