Ciao, grazie per lo spunto, ora ho un dubbio.. ho trovato uno script che mi genera una base (da personalizzare) di galleria come serve a me, quindi che mi carica delle foto tramite xml e me le mette una in fianco all'altra.
Problema: nel file di esempio che ho trovato, il codice per la galleria risiede nella DocumentClass e sullo stage non c'è nulla mentre a me serve che la galleria risieda in un MC già sullo stage in quanto il sito è già composto da altri oggetti sullo stage..
Questo il codice caricato dalla DocumentClass, come convertirlo in codice sulla timeline del mc che voglio??
Codice PHP:
package classes {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.motion.easing.Exponential;
import fl.motion.easing.Back;
import gs.TweenMax;
public class Main extends MovieClip {
private var __images:XML;
private var __cont:uint;
private var __y:uint;
private var __x:uint;
public function Main () {
this.x = this.y = 20;
initStage();
loadXML();
initFooter();
}
private function initStage() {
stage.scaleMode = "noScale";
stage.align = "TOP_LEFT";
}
public function loadXML() {
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, function(event:Event){
__images = new XML(event.target.data);
showImagen();
});
loader.load(new URLRequest("images.xml"));
}
private function showImagen () {
if (__cont < __images.image.length()) {
var loader:Loader = new Loader();
var request:URLRequest = new URLRequest(__images.@tnPath+__images.image[__cont].@source);
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.INIT, loaderHandler);
__cont++;
}
}
private function loaderHandler(event:Event) {
var holder:Sprite = new Sprite;
holder.addChild(event.currentTarget.content);
if (__cont > 1) {
holder.x = this.width + 0;
}
addChild(holder);
//TWEEN MAX
holder.alpha = .5;
TweenMax.to(holder, 1, {colorMatrixFilter:{saturation:0}});
TweenMax.from(holder, 1, {alpha:0, y:"300", ease:Back.easeOut, overwrite:false, onComplete:function () {
var mouseTween:TweenMax;
holder.addEventListener(MouseEvent.MOUSE_OVER, function (event:MouseEvent) {
TweenMax.removeTween(mouseTween);
mouseTween = TweenMax.to(event.currentTarget, .5, {alpha:1, y:20, colorMatrixFilter:{saturation:1}, ease:Exponential.easeOut, overwrite:false});
});
holder.addEventListener(MouseEvent.MOUSE_OUT, function (event:MouseEvent) {
TweenMax.removeTween(mouseTween);
mouseTween = TweenMax.to(event.currentTarget, .5, {alpha:.5, y:0, colorMatrixFilter:{saturation:0}, ease:Exponential.easeOut, overwrite:false});
});
}});
showImagen();
}
private function initFooter () {
var footer:Footer = new Footer();
footer.y = 200;
TweenMax.from(footer, .5, {y:"300", alpha:0, delay:2, ease:Exponential.easeOut});
addChild(footer);
}
}
}