According to your original explanation the only event handler for
"remoteDateEvent" is added to the parent container. All the forms do is
issue events.
If you really are doing addEventListener to child2, then
child2.removeEventListener("remoteDateEvent", remoteClickHandler);
is what you need.
removeAllChildren should be done on the parent container.
so, first remove handlers, then remove forms.
Paul
----- Original Message -----
From: "markgoldin_2000" <[email protected]>
To: <[email protected]>
Sent: Thursday, January 08, 2009 7:54 PM
Subject: [flexcoders] Re: Release a child .... again
>I am not removing the handles at all because I dont know where to put
> code for that.
> I tried (child2)
> creationComplete="init();"
> ..
> private function init():void
> {
> parent.removeEventListener("remoteDateEvent", remoteClickHandler);
> }
> Does not help.
>
> Children removal is removeAllChildren.
>
> --- In [email protected], "Paul Andrews" <p...@...> wrote:
>>
>> ----- Original Message -----
>> From: "markgoldin_2000" <markgoldin_2...@...>
>> To: <[email protected]>
>> Sent: Thursday, January 08, 2009 7:12 PM
>> Subject: [flexcoders] Release a child .... again
>>
>>
>> > Still cannot get it work.
>> > Here is my scenario:
>> >
>> > 1. Container adds child1 to itself.
>> > 2. Container adds child2 to itself.
>> > Child2 adds a custom event listener to parent (Container):
>> > parent.addEventListener("remoteDateEvent", remoteClickHandler,
>> > false, 0, true);
>> > 3. Child1 dispatches a custom event:
>> > private function executeRun(event:KeyboardEvent):void
>> > {
>> > if(event.charCode == 13)
>> > {
>> > var eventObj:remoteDateRun = new remoteDateRun("remoteDateEvent");
>> > dispatchEvent(eventObj);
>> > }
>> > }
>> > 4. Child2 handles custom event:
>> > public function remoteClickHandler(event:remoteDateRun):void
>> > {
>> > runDate = event.runDate;
>> > dailyJobSumaryList(lineId);
>> > }
>> > At this point everything works.
>> > Now, after some user action both forms are removed form the
> Container
>> > and all previous steps are repeated.
>> > At this point everything still works.
>> > Now user is going back to his initial selection. Both forms are
>> > removed again and 3rd set of forms is added to the Container. At
> this
>> > point if a child1 dispatches a custom event then child2 form set
> #1
>> > will get it to handle. Can someone please just put step by step
>> > instruction how to make sure that a form is released and
> collected?
>> > I have spent days if not more trying to fix the problem.
>>
>> Be better if you can make a complete example. You say that child2
> handles
>> the event, yet you also say you add the event handler to the parent
>> container, nor do you show any code to remove the handlers or the
> children.
>>
>> Paul
>>
>> > Thanks in advance.
>>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>