in discussion ActionScript 3 Code / AS3 Help » Singletons not supported in AS3 - Why?
check this link out I agree with the post that Singletons can simply be enforced with a tiny bit of documentation, but this is interesting nonetheless.
check this link out I agree with the post that Singletons can simply be enforced with a tiny bit of documentation, but this is interesting nonetheless.
Greetings, glad that inspired something. I hope you find the time to contribute here.
Might as well introduce myself, I'm a mid-level Flash Dev working out of Chicago. I'm currently with Whittmanhart Interactive. I've been a longtime reader of Eric's work, he kind of got me to break the boundary from design to development when I first saw his Speaker wire test.
Why are singletons not supported in AS3? Are there any inventive ways to work around this? I find myself translating a lot of classes from AS2 and AS3 and I run into this problem a lot.
Flex has removeAllChildren, but outside of Flex, you need to roll your own for now. An example.
private function removeAllChildren( containerObj:* ):void
{
while ( containerObj.numChildren > 0 )
{
container.removeChildAt(0);
// Of course this does not ensure Garbage Collection,
// You'll still need to provide this logic.
}
}
Thanks so much Helmut, I really do appreciate it!
Hi from the community forum - I took a look at your question !
I was gone through the link you provided…
[*http://ericd.wikidot.com/forum/c-31717/general-discussion | AS3 General]
Best regards
Helmut
// ActionScript 3 event handler
function clickSubmit(event:MouseEvent):void {
stage.invalidate();
gotoAndStop("submitFrame");
}
// add clickSubmit event handler as listener of the
// click event received by submit_button instance
submit_button.addEventListener(MouseEvent.CLICK, clickSubmit);
Hey there!