Comment exécuter une fonction jQuery depuis un flash ?
Bonjour à tous ;)
Je me permets de venir vous exposer mon problème car je galère comme pas possible :cry:
Voici ce que je souhaiterais faire : exécuter une fonction jQuery depuis un flash.
Cette fonction doit permettre l'affichage d'une popin.
Voici le code me servant de test : utilisation d'une image map + jQuery pour afficher ma popin
jQuery utilisé : query-latest.pack.js
JS
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
$(document).ready(function() {
//select all the AREA tag with name equal to modal
//$('area[name=modal]').click(function(e) {
$('area').click(function(e) {
//Cancel the link behavior
e.preventDefault();
//Get the AREA tag
var id = $(this).attr('href');
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
//$('#mask').fadeIn(2000);
$('#mask').fadeTo("fast",0.6);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(800);
});
//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
//if mask is clicked
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
} |
CSS
Code:
1 2 3 4 5 6
| body{font-family:verdana;font-size:15px;padding:0;margin:0;}
a{color:#333;text-decoration:none}
a:hover{color:#ccc;text-decoration:none}
#mask{position:absolute;left:0;top:0;z-index:9000;background-color:#000;display:none;}
#boxe .window{position:absolute;left:0;top:0;width:1030px;height:596px;display:none;z-index:9999;padding:0;}
#boxe #dialog{width:1030px;height:596px;padding:0;background-color:#fff;} |
HTML
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <img src="img/home.jpg" width="1263" height="1200" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="860,446,1111,698" href="#dialog" name="modal" />
<area shape="rect" coords="867,762,1105,783" href="#dialog" name="modal" />
<area shape="rect" coords="390,846,610,1117" href="#dialog" name="modal" />
<area shape="rect" coords="280,3,1026,92" href="#dialog" name="modal" />
</map>
<div id="boxe">
<div id="dialog" class="window">
Résultats et rapports du jour | <a href="#"class="close"/>Fermer X</a><br /><br />
<iframe src="http://www.google.fr" width="1030" marginwidth="0" height="570" marginheight="0" scrolling="auto" frameborder="0" hspace="0" vspace="0"></iframe>
</div>
<div id="mask"></div>
</div> |
Code dans mon .FLA : AS2
Code:
1 2 3 4 5
| import flash.external.*;
btn.onRelease = function() {
ExternalInterface.call("");
} |
Que dois-faire pour déclencher l’apparition du popin lorsque je clique dans mon flash ?
Le JS actuel fonctionne avec le TAG "area" et l'attribut "href".
Par quoi remplacer dans mon .fla : ExternalInterface.call("nomDeMaFonction"); ?
Sinon pourriez-vous me proposer une alternative au script/méthode utilisé ?
Merci d'avance pour votre aide :ccool: