开发者

Stopping a jQuery Content Slider while Flash content plays

Does anyone know a simple script that one could add开发者_如何学Go to a custom jQuery content slider that would make the slider stop while Flash content is being played inside?

Or, alternatively, just make the slider stop while hovering the mouse over it?

All the best, Robert


Provided that you have access to the Flash script, Flash & Javascript can communicate via the ExternalInterface class so you could implement a JQuery function that would be called from Flash when the movie starts playing.

in JQuery

  function stopMySlider()
  {
     //your javascript code here
  }

in Flash

import flash.external.ExternalInterface;

    //your constructor
    public function Main()
    {
         init();
    }

    // any function that would get the movie to start playing
    private function init():void
    {
       ExternalInterface.call('stopMySlider');
    }

If you don't have access to the Actionscript code, one solution could be to create a loader component in Actionscript. There are plenty of examples around so here's only a brief description of the code:

   var loader:Loader = new Loader();
   // add your event listeners here
   loader.load( new UrlRequest('path to your swf') );

   private function onLoadComplete(event:Event )
   {
       addChild( event.target.content );
       ExternalInterface.call('stopMySlider');
   }


you can call a javascript function (like mySliderStop()) from flash via getUrl (or navigateURL).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜