Hi,
Consider this scenario we have a class A which is singleton it has a function Sum(a,b) ** . Now we have two classes **Class B and Class C respectively. Both classes (B,C) call add function and listen for a event.
Class A
{
function add(a:int,b:int):void
{
c:int = a+b;
dispatchEvent(new myEvent(myEvent.addComplete,c));
}
}
Class B
{
function addSomething():void
{
var objectA:A = new A();
objectA.addEventListener(myEvent,onAddComplete);
var a:int = 10;
var b:int = 20;
objectA.add(a,b);
}
function onAddComplete(e:myEvent):void
{
trace(e.something);
}
}
Similarly there is a C and D class. Now when lets say both classes call A's add function (when A is singleton) how does one insure that the right answer is returned to the right listener.
Secondly what if the calls are changing something, is there a locking in singleton?