Problem with Flash ExternalInterface on Google App Engine

后端 未结 3 1433
盖世英雄少女心
盖世英雄少女心 2020-12-10 09:29

I\'ve been struggling with this for the past couple hours now and I really don\'t know what could be wrong. I\'m simply trying to get Javascript to communicate text with Fla

3条回答
  •  温柔的废话
    2020-12-10 10:00

    It probably doesn't have to do with Google app engine per se, since the whole thing's running in the browser -- unless there's some sort of server dependency somewhere you haven't mentioned. Assuming that's not the case...

    If you're able to get Flash to call into JavaScript with ExternalInterface.call(), but not JavaScript to call back into Flash, then it's probably one or two things: your EI callback & handler aren't wired up properly (in Flash), or your JavaScript doesn't have a handle on the SWF object in the browser.

    You might try posting some code, but in the meantime, here's something I know works in both IE and FireFox. First, the browser code:

    
    
    
    
    
        



    And now, the Flash code (in my case, it's Flex, so hopefully it's clear):

    
    
    
        
            
        
    
        
            
            
        
    
    
    

    The example demonstrates Flash calling into JavaScript with some text, and JavaScript calling back into Flash in the same way. Some points to pay attention to:

    • Make sure you wait to call into Flash until Flash has notified the browser it's ready to begin receiving calls (as indicated by my callbacksInitialized() method).
    • Test to be sure you're using the appropriate browser-specific object reference (e.g., window["HelloMac"] vs. document["HelloMac"]).

    Without knowing more, I'm guessing it's one of these two items, since that's been my experience. Hope it helps! I'll keep an eye on the post for follow-ups in case you have any.

提交回复
热议问题