views:

44

answers:

0

So i have a simple set up.

index.php which embeds myswf.swf into the page using swfobject 2.

myswf wants to open a new window to interface with an external website - in this instance paypal. (for what its worth, this problem exists even when using documents on my own server - so its not the whole paypal thing)

When the process has finished, the window loads a page from my server offering the choice of confirming the purchase or cancelling the purchase.

When the visitor clicks on the cancel link, I want to trigger a call back that i have registered in myswf.swf via javascript - pretty simple. Something like this:

    private function openExternal(e:Event){

        ExternalInterface.call('window.open','about:blank', 'MyPage','height=500,width=500,toolbar=no,scrollbars=yes');

        ExternalInterface.addCallback('myCallback', myCallback);

        var url:URLRequest = new URLRequest(url);

        url.method = "POST";        

        navigateToURL(url, "MyPage");

    }

No problems, the page is opened and everything loads across browsers and avoids pop up blockers The navigate to url is needed because of safaris inability to open a page via a direct js call from flash, in other browsers it ops open fine, then navigate to url targets that window and loads.

Now, on my final page i have a simple little javascript function like this:

<script language="Javascript">


    function sendCallback(){

        //alert('window opener: ' + window.opener);
        window.opener.window.document.getElementById('myswfID').myCallback('hello world!');         

    }


</script>

Where myswfID == the id the swfobject embeds with. This works fine with firefox and safari, but stumbles over when used with safari.

The issue is safari sees window.opener == null, and therefore can never speak directly to the index.php

If anyone has ANY ideas, id love to hear them!