English 中文(简体)
外在外在外在外面的外在外面外面,没有正确的工作。
原标题:ExternalInterface.addCallback does not work right

我的法典如下:

function onFlashReady() {        
    sendToAS("sit");
}

function callJS(value) {        
    onFlashReady();
    return "Hi Flash.";
}

function thisMovie(movieName) {
     if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName];
     } else {
         return document[movieName];
     }
 }
 function sendToAS(value) {         
     thisMovie("FlashID").callAS(value);
 }

html:

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="850" Height="588" id="FlashID" tabindex="0">
      <param name="movie" value="BusFlex/BusProducts.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="allowScriptAccess" value="always" />
      <param name="swfversion" value="6.0.65.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!--[if !IE]>-->
         <object type="application/x-shockwave-flash" data="BusFlex/BusProducts.swf" width="850" height="588">
      <!--<![endif]-->
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="allowScriptAccess" value="always" />
      <param name="swfversion" value="6.0.65.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <div>
         <h4>Установите или включите Adobe Flash Player.</h4>
         <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
      </div>
      <!--[if !IE]>-->
         </object>
      <!--<![endif]-->
      </object>
      <script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
      <script type="text/javascript">
      <!-- swfobject.registerObject("FlashID"); //-->
      </script>
      </div>

说明

protected function application1_creationCompleteHandler(event:FlexEvent):void
{
     flash.system.Security.allowDomain("http://mysite.ru");
     flash.system.Security.allowDomain("http://localhost");
     if(ExternalInterface.available)  
     {
          ExternalInterface.addCallback("callAS", fromJS);
     }
     ExternalInterface.call("callJS", "Hello JS!");
}
public function fromJS(str:String):void 
{
   ...
}

但是,它只在独立实体开展工作。 在论坛中,这并不可行。 请帮助我。

最佳回答

如同这个问题一样,见诸于您的闪电中,Catherine browsers依赖embedtag,但您有object。 3. 在您的标注范围内使用类似内容:

<embed type="application/x-shockwave-flash" data="BusFlex/BusProducts.swf" width="850" height="588" allowscriptaccess="always">
</embed>
问题回答

Thanks!!! I was looking for an answer for two days! This my new code:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="850" height="588" id="FlashID" tabindex="0">
    <param name="movie" value="BusFlex/BusProducts.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="allowScriptAccess" value="always" />
    <param name="swfversion" value="6.0.65.0" />
    <param name="expressinstall" value="Scripts/expressInstall.swf" />

    <!--[if !IE]>-->
    <embed src="BusFlex/BusProducts.swf" type="application/x-shockwave-flash" data="BusFlex/BusProducts.swf" width="850" height="588" allowscriptaccess="always" name="FlashID">

      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="allowScriptAccess" value="always" />
      <param name="swfversion" value="6.0.65.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!--<![endif]-->

      <!--[if IE]>
      <div>
        <h4>YCTAHOBUTE Adobe Flash Player.</h4>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
      </div>
      <![endif]-->
     <!--[if !IE]>-->
     </embed>
    <!--<![endif]-->
  </object>




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签