Flash question

Out of context: Reply #2

  • Started
  • Last post
  • 3 Responses
  • liamegan0

    It's not going to be entirely foolproof - for example, it will probably fail in opera on discreet window blurring events - but you're going to need to use javascript to detect the window blur and focus and pass a call back to flash. You can do this like so:

    // FLASH CODE
    import flash.external.ExternalInterface...
    function getFocus(str:String):Void
    {received_ti.text = "From JavaScript: " + str;
    }
    ExternalInterface.addCallback("s... this, getTextFromJavaScript);
    function clickSend(eventObj:Object):Void {
    var jsArgument:String = sending_ti.text;
    var result:Object = ExternalInterface.call("getTextF... jsArgument);
    received_ti.text = "Returned: " + result;
    }
    send_button.addEventListener("cl... clickSend);

    I'm assuming the use of AS2 here (but I can provide examples of AS3 usage too)

View thread