Using an ActionScript front-end invocation to launch a jQuery function on an HTML page

I have a project that extends an extensible web banner, and I'm having problems using a call to the Flash frontend.

What I'm trying to do is initiate the jQuery function on my HTML page by clicking a button inside my .swf banner.

The jQuery function simply extends the a field to open another .swf file.

--- This is the jQuery code at the beginning of my HTML page ---

<script type="text/javascript"> $(document).ready (function() { $(".contentBox").hide(); $(".bannerBox").click (function expand() { $(".contentBox").slideToggle(); } ); } ); </script> 

--- This is my ActionScript code ---

 clickMe.addEventListener(MouseEvent.CLICK,fnMouseOn); function fnMouseOn(e:MouseEvent):void { ExternalInterface.call('expand()') } 

Sorry if this question has already been answered elsewhere, and I did not understand, I searched for a solution for several hours, and I could not understand it.

Any help appreciated :-)

+4
source share
1 answer

Sunil D. Is this right. The extension function exists only in the context of the click destination and cannot be called otherwise, but with a small refactor you should be good to go:

 <script type="text/javascript"> $(document).ready (function() { $(".contentBox").hide(); $(".bannerBox").click (function(){expand();} ); } ); function expand(){ $(".contentBox").slideToggle(); } </script> 
+2
source

Source: https://habr.com/ru/post/1440636/


All Articles