0
votes

At the end of each child swf I want to trigger within the AIR app that they are done playing.

I have been able to add within the AIR app document class that loads these an event listener (Enter Frame) but that chews up cpu.

Am I able to do it the other way? Here is my attempt at customEvents but nothing fires.

Any ideas?

CustomEvent.as

package com.net {

import flash.events.*;

public class CustomEvent extends Event {
    // define variables
    public static const GOTEM:String = "gotEm";

    public function CustomEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) {
        super(type, bubbles, cancelable);
    }

    //in case of redispatch
    public override function clone():Event{
        return new CustomEvent(type, bubbles, cancelable);
    }
}
}

Within AIR APP:

stage.addEventListener("gotEm", swfFinished);

Within Child SWF:

stage.dispatchEvent(new CustomEvent(CustomEvent.GOTEM));

Thanks in advance for any suggestions and ideas.

1

1 Answers

1
votes

Instead of listening to Event.ENTER_FRAME, you could dispatch a custom event from within your child swf:

dispatchEvent(new Event("childComplete"));

Then you'd listen for only that event in your AIR app.