You need to dispatch the event after your F instance is added to the stage.
Right now the order of operations is like this:

1. instantiate root class
2. instantiate F
3. dispatch event from F
4. add listener to F
5. add F to root class display hierarchy

Obviously 4 and 5 need to be done before #3.

So you'll want to add an ADDED_TO_STAGE listener in F and then dispatch the
event in that listener callback.

-jonathan



On Mon, Aug 30, 2010 at 11:31 AM, Lehr, Theodore
<[email protected]>wrote:

> So now I am trying this:
>
> in .fla:
>
> var countF:int=0;
>
> function incCountF(e:Event):void
> {
>     countF++;
> }
>
> for ...... {
>     var newF:MDot = new MDot();
>    newF.addEventListener("increaseF",incCountF);
>   addChild(newF);
> }
>
>
> then in the .as I have:
>
> package
> {
>       [Event(name="increaseF")];
>
>       public function .......
>       {
>           var e:Event = new Event("increaseF");
>           dispatchEvent(e);
>
>        }
> }
>
> for some reason I think my listener is not catching it....
>
>
>
>
>
>
>
>
>
>
>
>
> ________________________________________
> From: [email protected] [
> [email protected]] On Behalf Of Henrik Andersson [
> [email protected]]
> Sent: Monday, August 30, 2010 1:43 PM
> To: Flash Coders List
> Subject: Re: [Flashcoders] Accessing .fla var
>
> Lehr, Theodore skriver:
> > In my .fla I have:
> >
> > var countF:int=0;
> >
> > then in the library I have a mc with linkage to an .as file
> >
> > In that .as file, I want to be able to:
> >
> > countF++;
> >
>
>
> Main timeline
> |____>frame 1
>       |___>variable
>       |___>instance of symbol
>            |_>Symbol
>               |_>assigned class
>                  |_>code to access the variable
>
> DocumentClass(parent).var++
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to