Flash 8 : ExternalInterface / Browser window
Par jeanphilippe, dimanche 10 septembre 2006 à 10:07 :: Flash 8 :: #220 :: rss
...ou comment utiliser ExternalInterface (flash.external.ExternalInterface) et sa méthode call pour jouer facilement sur les dimensions de la fenêtre du navigateur.
Grâce à cette méthode, il est très simple de communiquer avec le swf et le javascript.
L'exemple en image à cette adresse.
Le code des boutons dans Flash :
Le code dans la page html :
L'exemple en image à cette adresse.
Le code des boutons dans Flash :
import flash.external.*; sendSize1_btn.onRelease = function() { ExternalInterface.call("setSize1"); }; sendSize2_btn.onRelease = function() { ExternalInterface.call("setSize2"); }; sendSize3_btn.onRelease = function() { ExternalInterface.call("setSize3"); }; sendSize4_btn.onRelease = function() { ExternalInterface.call("maxIt"); };
Le code dans la page html :
function setSize1() { window.moveTo(0,0) window.resizeTo(width=800,height=600); } function setSize2() { window.moveTo(0,0) window.resizeTo(width=1024,height=768); } function setSize3() { window.moveTo(0,0) window.resizeTo(width=1280,height=924); } function maxIt() { var width = screen.availWidth; var height = screen.availHeight; window.resizeTo(width,height); window.moveTo(0,0) }
Commentaires
1. Le dimanche 10 septembre 2006 à 13:37, par Lasouche
2. Le dimanche 10 septembre 2006 à 14:50, par jeanphilippe
3. Le lundi 11 septembre 2006 à 01:06, par erixtekila
4. Le lundi 11 septembre 2006 à 08:26, par jeanphilippe
5. Le lundi 11 septembre 2006 à 10:21, par yoy
6. Le lundi 11 septembre 2006 à 10:39, par jeanphilippe
7. Le lundi 11 septembre 2006 à 17:52, par Tchupacabra
8. Le mardi 12 septembre 2006 à 20:31, par Laurent_Nancy
9. Le mercredi 13 septembre 2006 à 05:57, par jeanphilippe
10. Le mercredi 20 septembre 2006 à 21:35, par Fred
11. Le samedi 28 octobre 2006 à 20:53, par satsh
12. Le mardi 31 octobre 2006 à 10:49, par melonmaudic
13. Le mardi 31 octobre 2006 à 11:09, par melonmaudic
14. Le vendredi 24 novembre 2006 à 15:35, par Anakhin1
15. Le vendredi 24 novembre 2006 à 16:08, par jeanphilippe
16. Le vendredi 24 novembre 2006 à 16:21, par Anakhin1
17. Le vendredi 24 novembre 2006 à 16:31, par Anakhin1
18. Le vendredi 24 novembre 2006 à 16:48, par jeanphilippe
19. Le dimanche 26 novembre 2006 à 14:48, par Exekiel
20. Le dimanche 13 mai 2007 à 10:04, par elundil
21. Le jeudi 19 juillet 2007 à 00:15, par Masskime
22. Le mercredi 19 septembre 2007 à 14:26, par Guacamole
23. Le jeudi 14 février 2008 à 17:20, par uowis
24. Le vendredi 15 février 2008 à 15:33, par Rod
25. Le mercredi 26 mars 2008 à 16:16, par Nico
Ajouter un commentaire