begin process at 2012 05 27 19:40:03
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Flash / Flash MX

 > 

Scripts

 > 

ActionScript

 > 

problème d'amélioration de polaroid galery


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

problème d'amélioration de polaroid galery

mardi 24 mars 2009 à 15:27:10 | problème d'amélioration de polaroid galery

lirisnocif

Bonjour je souhaite utiliser cette galerie :

[ Lien ]

après avoir effectué plusieurs modifications pour remanier le script à ma façon, j'ai toujours un problème sur lequel je bute.

Alors voilà je cherche, lorsque l'on a agrandi l'image à pouvoir cliquer à nouveau sur celle ci pour la voir en plus grand lorsqu'il s'agit d'une image classique, ou a envoyer sur un lien sur une autre page lorsqu'il s'agit d'une photo de création de site internet et ou je souhaite envoyer les gens sur l'adresse internet du site. Tout ceci appelé par le xml externe(fictif) que voici :

//////////////////////////////////////////////////////////////////////////////////////////////////////

<?xml version="1.0" encoding="utf-8"?>
<photos>
<!-- Plase your photos here -->
<photo nom="reebok" desc="http://reebok.fr" url="_pics/1.jpg" />
<photo nom="nike" desc="http://nike.fr" url="_pics/2.jpg" />
<photo nom="carrefour" desc="http://carrefour.fr" url="_pics/3.jpg" />
<photo nom="converse" desc="http://converse.fr" url="_pics/4.jpg" />
<photo nom="adidas" desc="http://adidas.fr" url="_pics/5.jpg" />
<photo nom="free" desc="http://free.fr" url="_pics/6.jpg" />
<photo nom="alice" desc="http://alice.fr" url="_pics/7.jpg" />
<photo nom="google" desc="http://google.fr" url="_pics/8.swf" />
<photo nom="ricard" desc="http://ricard.fr" url="_pics/9.swf" />

</photos>


//////////////////////////////////////////////////////////////////////////////////////////////////

et le code action script :

//////////////////////////////////////////////////////////////////////////////////////////////////

stop();

import flash.display.BitmapData;
var photoHolder = new Array();
var skalerTempo = 3;
var thumbStr = 25;

var stageHeight = Stage.height;
var stageWidth = Stage.width;

xmlURL = (xmlURL) ? xmlURL:"photos.xml";


var loadet_xml:XML = new XML();
loadet_xml.ignoreWhite = true;
loadet_xml.onLoad = function (success){
var loop = (flickrID) ? loadet_xml.firstChild.firstChild.childNodes:loadet_xml.firstChild.childNodes;
var num = 0;
if (flickrID) {
for (var i = 0;i < loop.length;i++) {
if (loop[i].nodeName == "item") {
var loop2 = loop[i].childNodes;
photoHolder[num] = new Array();
itemObj.nom = listeItem[i].attributes.nom;
this.menuItems.push(itemObj);
for (var i2 = 0;i2 < loop2.length;i2++) {
if (loop2[i2].nodeName == "media:content") {
photoHolder[num].url = loop2[i2].attributes.url;
photoHolder[num].desc = loop2[i2].attributes.desc;
}
else if (loop2[i2].nodeName == "title") {
photoHolder[num].nom = loop2[i2].firstChild;
}
}
num++;
}
}
}
else {
for (i=0;i < loop.length;i++) {
photoHolder[i] = loop[i].attributes;


}
}
delete loadet_xml;
byggBilder();
}
loadet_xml.load(xmlURL);

function byggBilder() {
for (i=0;i < photoHolder.length;i++) {
mc = _root.attachMovie("fotoHolder","fotoHolder"+i,_root.getNextHighestDepth(),{_xscale:thumbStr, _yscale:thumbStr,_rotation:30 - 60*Math.random()});
mc.txt.text = photoHolder[i].nom;


if (Math.round(Math.random()*1) == 1) {
// tilfeldig y akse
mc._y = (Stage.height*Math.random()+mc._height*2);
if (Math.round(Math.random()*1) == 1) mc._x = Stage.width+(mc._width*2);
else mc._x = -(mc._width*2);
}
else {
// tilfeldig x akse
mc._x = (Stage.width*Math.random())+(mc._width*2);
if (Math.round(Math.random()*1)== 1) mc._y = Stage.height+(mc._height*2);
else mc._y = -(mc._height*2);
}
mc.newX = Math.round((mc._width+250) + (Stage.width/2-mc._width)*Math.random());
mc.newY = Math.round((mc._height+135) + (Stage.height/2-mc._height)*Math.random());
mc.oldRotation = mc._rotation;
mc.oldX = mc.newX;
mc.oldY = mc.newY;
mc.startX = mc._x;
mc.startY = mc._y;
mc.oldHeight = mc._yscale;
mc.oldWidth = mc._xscale;
mc.id = i;
mc.onEnterFrame = fotoAnimer;
mc.filters = [fotoSkygge];


mc.dragPol.onPress = drag;

mc.dragPol.onReleaseOutside = mc.dragPol.onRelease = stopdrag;
photoHolder[i].mc = mc;
lastBilde(mc,photoHolder[i].url);
//getURL('desc');
delete mc;
}
antallBilder = i;
}
function lastBilde(mc, url) {
mc.createEmptyMovieClip("tmp",mc.getNextHighestDepth());
lastBildeH.loadClip(url, (flickrID) ? mc.bildeHolder:mc.tmp);


}
var lastBildeH:MovieClipLoader = new MovieClipLoader();
var lastBildeHL:Object = new Object();
lastBildeHL.onLoadStart = function(mc:MovieClip):Void {
mc._parent.attachMovie('preLoader','preloader',mc._parent.getNextHighestDepth());
loaderFarge = new Color(mc._parent.preloader);
mc._parent.preloader.loadtxt.text = "";
loaderFarge.setRGB(0xFFFFFF);
mc._parent.preloader._y = -10;
mc._visible = false;
}

lastBildeHL.onLoadProgress = function(mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
mc._parent.preloader.percent._width = numPercentLoaded;
}

lastBildeHL.onLoadInit = function(mc:MovieClip) {
mc._parent.preloader.removeMovieClip();
var mc2 = mc._parent.bildeHolder;
if (!flickrID) {
var myBitmap = new BitmapData(mc._width, mc._height,true,0xFFFFFF);
myBitmap.draw(mc);
mc._parent.bildeHolder.attachBitmap(myBitmap, mc._parent.bildeHolder.getNextHighestDepth(), "auto", true);

mc.removeMovieClip();


}


var wP = 468/mc2._width;
var hP = 450/mc2._height;
mc2._width *= (wP < hP) ? hP:wP;
mc2._height *= (wP < hP) ? hP:wP;
mc2._x += -((mc2._width-468)/2);
mc2._y += -((mc2._height-450)/2);
mc2._visible = true;
}
lastBildeH.addListener(lastBildeHL);


_root.attachMovie("help","help",_root.getNextHighestDepth());
help._x = 42;
help._y = 48;
help.filters = [fotoSkygge];

function rensFilm() {
for (i=0;i<antallBilder;i++) {
mc = eval("fotoHolder"+i);
mc.oldY = mc.startY;
mc.oldX = mc.startX;
mc.onEnterFrame = fotoAnimerTilbake;
//getURL(mc,photoHolder[i].desc);
removeMovieClip(navigering);
}
}
function fotoAnimer() {
this._y += (this.newY-this._y)/skalerTempo;
this._x += (this.newX-this._x)/skalerTempo;
if (Math.round(this._y) == this.newY) delete this.onEnterFrame;
}
function fotoAnimerTilbake() {
this._y += (this.oldY-this._y)/skalerTempo;
this._x += (this.oldX-this._x)/skalerTempo;
this._xscale += (this.oldWidth-this._xscale)/skalerTempo;
this._yscale += (this.oldHeight-this._yscale)/skalerTempo;
this._rotation += (this.oldRotation-this._rotation)/skalerTempo;
this.nesteKnapp._alpha += (0-this.nesteKnapp._alpha)/skalerTempo;
this.forrigeKnapp._alpha += (0-this.forrigeKnapp._alpha)/skalerTempo;
if ((Math.round(this._y) == this.oldY) && (Math.round(this._x) == this.oldX)) {
delete this.nesteKnapp.onRelease;
delete this.Knapp.onRelease;
delete this.onEnterFrame;
}
}
function fotoSkaler() {
this._xscale += (100-this._xscale)/skalerTempo;
this._yscale += (100-this._yscale)/skalerTempo;
this._rotation += (this.newRotation-this._rotation)/skalerTempo;
this._x += ((Stage.width/2)-this._x)/skalerTempo;
this._y += ((Stage.height/2)-this._y)/skalerTempo;
this.nesteKnapp._alpha += (60-this.nesteKnapp._alpha)/skalerTempo;
this.forrigeKnapp._alpha += (60-this.forrigeKnapp._alpha)/skalerTempo;
if (Math.round(this._width) == this.newWidth) {
delete this.onEnterFrame;
}
}
function drag() {
if ((fotoSomBlirVist != this._parent) && (!this._parent.onEnterFrame)) this._parent.startDrag(this,300, 250, 730, 470);
if (!this.click) {
this.click = true;
this.timer = getTimer()/1000;
}
else {

this.timer2 = getTimer()/1000;

if ((this.timer2-this.timer)<.25) {
visFoto(this._parent);

}
else {
this.timer = getTimer()/1000;
this.click = true;

}

}
this._parent.swapDepths(_root.getNextHighestDepth());
if (fotoSomBlirVist) fotoSomBlirVist.swapDepths(_root.getNextHighestDepth());
}
function stopdrag() {
mc = this._parent;
mc.stopDrag();
if ((fotoSomBlirVist != mc) && (!mc.onEnterFrame)) {
mc.oldX = Math.round(mc._x);
mc.oldY = Math.round(mc._y);
}
}
function visFoto(mc:MovieClip) {
if (fotoSomBlirVist == mc) {
fotoSomBlirVist.onEnterFrame = fotoAnimerTilbake;
delete fotoSomBlirVist;
}
else {
fotoSomBlirVist.onEnterFrame = fotoAnimerTilbake;
mc.newRotation = 0;
mc.oldRotation = mc._rotation;
mc.nesteKnapp.onRelease = function() {
visNeste(); }
mc.forrigeKnapp.onRelease = function() { visForrige(); }
mc.onEnterFrame = fotoSkaler;
fotoSomBlirVist = mc;
}
if (fotoSomBlirVist) fotoSomBlirVist.swapDepths(_root.getNextHighestDepth());
}
function visNeste() {
var nb = 0;
if (fotoSomBlirVist) {
nb = fotoSomBlirVist.id +1;
if (nb == antallBilder) nb = 0;
}
visFoto(eval("fotoHolder"+nb));
}
function visForrige() {
var fb = 0;
if (fotoSomBlirVist) {
fb = fotoSomBlirVist.id -1;
if (fb < 0) fb = antallBilder-1;
}
visFoto(eval("fotoHolder"+fb));
}



var stageL:Object = new Object();
stageL.onResize = function() {
for (i=0;i<antallBilder;i++) {
mc = eval("fotoHolder"+i);
if (mc != fotoSomBlirVist) {
mc._x = Math.round(Stage.width * (mc._x/stageWidth));
mc._y = Math.round(Stage.height * (mc._y/stageHeight));

}
else {
fotoSomBlirVist._x = Stage.width/2;
fotoSomBlirVist._y = Stage.height/2;
}
mc.oldX = Math.round(Stage.width * (mc.oldX/stageWidth+400));
mc.oldY = Math.round(Stage.height * (mc.oldY/stageHeight+400));
mc.newX = Math.round(Stage.width * (mc.newX/stageWidth+200));
mc.newY = Math.round(Stage.height * (mc.newY/stageHeight+200));
mc.startX = Math.round(Stage.width * (mc.startX/stageWidth-400));
mc.startY = Math.round(Stage.height * (mc.startY/stageHeight-400));
}
stageWidth = Stage.width;
stageHeight = Stage.height;

}
Stage.addListener(stageL);


Cette discussion est classée dans : mc, math, width, stage, if


Répondre à ce message

Sujets en rapport avec ce message

amélioration gallery tout en action script [ par pseudoFuck ] Hello,je suis en train d'apporter une amélioration aux script 16971 qui est une gallerie tout en action script, assez bien foutue d'ailleurs.Je suis e slideshow [ par fluf ] Bonjour,J'ai récupéré diverses codes sur ce forum pour créer un slideshow avec appel des images dans un fichier XML.L'appel se fait correctement mais Problème visuel d'un swf charger avec LoadClip [ par Xenark ] Bonsoir j'ai besoin d'aide pour mon site : http://uninfographiste.free.fr/ J'en suis à la fin j'ai passé de nombreuse étape de programmation qui étai [AS2] comparer mc.height et stage.heigh avec un if [ par emfromkraland ] Bonjour à vous, je viens pas souvent poster mais là je bloque tout seul et google ne m'aide en rien... Bref. J'ai un swf que j'ai besoin de faire sli Correction de syntax pour passer un code As1 en As2 [ par marine34000 ] Bonjour, J'ai une partie d'un code en As1 qui ne marche pas quand je le passe en flash 8 script 2 Je pense que c'est le "(_global._popUpLevel==undef problème de resize sur un clip [ par duceduce ] bonjour à tous, voilà j'ai un petit problème sur un clip dans un full browser qui doit être resizé en proportion du background (lui aussi en resize) q [AS2] Galerie d'animations .swf [ par Xenark ] Bonjour, Je viens vers vous car depuis plus d'un an j'essaye de finir mon site en vain... http://uninfographiste.free.fr/ Actuellement sur le site redimentionner un clip proportionnellement (Tween) [ par kenshir0H ] Bonjour, je voudrais pouvoir redimensionner un clip proportionnellement au navigateur, sans pour autant qu'il ne prenne tout l'espace de la scène. Gestion site full flash en actionscript 3// Message error #1009: impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul. [ par opendesigns ] Message error #1009: impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul. Gestion site full flash en actionscript 3 Bonjo


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,156 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales