Besoin d'aide!!!! URGENT!!!
Je suis entrain de faire un site entièrement en flash. Cette galerie doit s'afficher à un endroit bien précis de la page et lorsqu'on click sur un de boutons du menu.
J'ai crée une galerie d'images (un fichier XML et en AS2) dont voici le code:
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");
myGalleryXML.onLoad = function() {
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;
_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;
callThumbs();
createMask();
scrolling();
}
function callThumbs(){
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;
var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);
for (i=0; i<_root.myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth() );
myThumb_mc._y = _root.thumb_height*i;
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
preloader.onLoadComplete=function(target){
target.onRelease=function(){
callFullImage(this._name);
}
target.onRollOver=function(){
callRollImage(this._name);
this._alpha=50;
}
target.onRollOut=function(){
callBlackImage(this._name);
this._alpha=100;
}
}
}
}
function callFullImage(myNumber) {
myURL = myImages[myNumber].attributes.full_url;
_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;
var fullClipLoader = new MovieClipLoader();
fullClipLoader.loadClip("full_images/"+myURL,fullImage_mc);
}
function callRollImage(myNumber) {
myURL = myImages[myNumber].attributes.roll_url;
_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;
var fullClipLoader = new MovieClipLoader();
fullClipLoader.loadClip("roll_images/"+myURL,fullImage_mc);
}
function callBlackImage(myNumber) {
myURL = myImages[myNumber].attributes.black_url;
_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;
var fullClipLoader = new MovieClipLoader();
fullClipLoader.loadClip("black_images/"+myURL,fullImage_mc);
}
function createMask() {
_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;
mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);
container_mc.setMask(mask_mc);
}
function scrolling() {
_root.onEnterFrame = function() {
container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*7;
if (container_mc._y>mask_mc._y) {
container_mc._y = mask_mc._y;
}
if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
}
}
}
et le code XML
<gallery thumb_width="129" thumb_height="90" gallery_width="129" gallery_height="375" gallery_x="35" gallery_y="160" full_x="240" full_y="160">
<image thumb_url="t_aie.gif" full_url="aie.jpg" roll_url="cannondale.jpg" black_url="black.jpg"/>
<image thumb_url="t_chute.gif" full_url="chute.jpg" roll_url="cannondale.jpg" black_url="black.jpg"/>
<image thumb_url="t_saut.gif" full_url="saut.jpg" roll_url="cannondale.jpg" black_url="black.jpg"/>
<image thumb_url="t_appart_1.gif" full_url="appart_1.jpg" roll_url="loto.jpg" black_url="black.jpg"/>
<image thumb_url="t_cartier 2.gif" full_url="cartier 2.jpg" roll_url="loto.jpg" black_url="black.jpg"/>
<image thumb_url="t_durex_moquette_1.gif" full_url="durex_moquette_1.jpg" roll_url="durex.jpg" black_url="black.jpg"/>
<image thumb_url="t_durex_le_lit_2.gif" full_url="durex_le_lit_2.jpg" roll_url="durex.jpg" black_url="black.jpg"/>
<image thumb_url="t_racisme.gif" full_url="racisme.jpg" roll_url="la_halde.jpg" black_url="black.jpg"/>
<image thumb_url="t_hommes_forts_fenwick.gif" full_url="hommes_forts_fenwick.jpg" roll_url="fenwick.jpg" black_url="black.jpg"/>
</gallery>
Cela marche très bien!!!
Mon soucis c'est que je veux ceci (cet galerie) s'affiche que lorsque on click sur le bouton du menu qui doit la faire afficher à un endroit bien particulier de mon site, pendant quelques images et pas tout au long de mon site...
Qu'est ce qu'il faut ajouter à mon code pour que cela fonctionne? (j'ai essayé de mettre la galerie dans un clip vide mais ça ne marche pas!!!)
Aussi essayé de charger le swf de cet galerie à l'endroit précis dans ma page , mais je ne sais pas comment faire ou quel code mettre...
Je regarder plusieurs tutoriels mais je ne trouve rien!!!
Alors si quelqu'un pourrait m'aider car je ne suis pas très forte pour coder... Cela fait plusieurs jours que je suis plongé dedans et je ne m'en sorts pas!!!
Merci indéfiniment!!!
A +