Número de btn anterior AS2 slideshow
- cosmic_billion
- Newbie


- Registrado: Nov 05, 2009
- Mensajes: 14
- Loc: Amsterdam, the Netherlands
- Status: Offline
Hola gente de Ozzu,
¿Cómo está todo el mundo?
Hay un gran Action Script slideshow 2/XML código que encontré a través de un enlace en Smashing Magazine, la razón que me gusta es porque tenía una interpolación poco agradable entre imágenes, pero dun dun dun...
He logrado insertar un siguiente, reproducir y pausar botón pero no la función de botón anterior.
La prev_btn se supone que llame la posición actual de la imagen - 1, del mismo modo que el next_btn pide la imagen actual + 1. Esto tiene sentido pero conseguir confundido con algo...
Tu ayuda será aprreciated.
import gs.*;
import gs.easing.*;
//---Load XML
var xmlPath = "photos.xml";
var photos_xml = new XML();
photos_xml.ignoreWhite = true;
var imageList:Array = new Array();
photos_xml.onLoad = function(success) {
if (success) { // ----------- load successful
// ----------- convert XML content to an array
imageList = photos_xml.firstChild.childNodes;
// ----------- Do some action once xml is loaded
loadImage();
// ----------- Do some action once xml is loaded
} else {
// ----------- problem loading, check path
trace("Error loading photos_xml");
}
}
//---Load Images
var currentImage:Number = 0;
var imageLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
imageLoader.addListener(loadListener);
loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number):Void {
TweenLite(dot)to(container_mc.background_mc, 1, {_width:target_mc._width + 20, _height:target_mc._height + 20, ease:Strong.easeOut});
TweenLite(dot)to(container_mc.border_mc, 1, {_width:target_mc._width, _height:target_mc._height, ease:Strong.easeOut});
TweenLite(dot)to(container_mc.mask_mc, 1, {_width:target_mc._width, _height:target_mc._height, ease:Strong.easeOut});
// center content
var clipXTarg = Math.round((Stage.width/2)-((target_mc._width+20)/2));
var clipYTarg = Math.round((Stage.height/2)-((target_mc._height+20)/2));
TweenLite(dot)to(container_mc, 1, {_x:clipXTarg, _y:clipYTarg, ease:Strong.easeOut});
// find previous image
if(currentImage == 0){
var prevImgNum = imageList.length -1;
}else{
var prevImgNum = currentImage -1;
}
var prevImg = container_mc.pics_mc["pic"+prevImgNum];
TweenLite(dot)to(prevImg, 1, {autoAlpha:0, onComplete:removePrevious});
}
loadListener.onLoadComplete = function(target_mc:MovieClip):Void {
TweenLite(dot)to(target_mc, 1, {autoAlpha:100, delay:1});
setTimer();
}
//---Functions List
function setTimer(){
timer = setInterval(loadImage, 5000);
}
function removePrevious(){
if(prevImg != undefined){
removeMovieClip(prevImg);
}
// increment the current image
if(currentImage < imageList.length -1){
currentImage = currentImage + 1;
}else{
currentImage = 0;
}
}
//Load the next image automatically
function loadImage(){
var loadURL = imageList[currentImage].attributes.imgurl;
var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+currentImage,container_mc.pics_mc.getNextHighestDepth());
targetClip._alpha = 0;
clearInterval(timer);
// load the new image
imageLoader.loadClip(loadURL,targetClip);
}
//Load the next image if the button was pressed
function loadImagePrevious() {
if(currentImage == 0){
var prevImgNum = imageList.length -1;
var loadURL = imageList[prevImg].attributes.imgurl;
var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+prevImg,container_mc.pics_mc.getNextHighestDepth());
targetClip._alpha = 0;
clearInterval(timer);
// load the new image
imageLoader.loadClip(loadURL,targetClip);
}else{
var prevImgNum = currentImage - 1;
var loadURL = imageList[prevImg].attributes.imgurl;
var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+prevImg,container_mc.pics_mc.getNextHighestDepth());
targetClip._alpha = 0;
clearInterval(timer);
// load the new image
imageLoader.loadClip(loadURL,targetClip);
}
}
//---On First Load
photos_xml.load(xmlPath);
stop();
//---Buttons
next_mc.onRelease = function() {
clearInterval(timer);
timer = setInterval(loadImage, 500);
pause_mc._visible = true;
play_mc._visible = false;
}
prev_mc.onRelease = function() {
clearInterval(timer);
????
pause_mc._visible = true;
play_mc._visible = false;
/*if(currentImage == 0){
var prevImgNum = imageList.length -1;
}else{
var prevImgNum = currentImage - 1;
}
var prevImg = container_people_mc.pics_mc["pic"+currentImageNumber];
TweenLite(dot)to(currentImage, 1, {autoAlpha:0, onComplete:removeCurrent});
*/}
Saludos
¿Cómo está todo el mundo?
Hay un gran Action Script slideshow 2/XML código que encontré a través de un enlace en Smashing Magazine, la razón que me gusta es porque tenía una interpolación poco agradable entre imágenes, pero dun dun dun...
He logrado insertar un siguiente, reproducir y pausar botón pero no la función de botón anterior.
La prev_btn se supone que llame la posición actual de la imagen - 1, del mismo modo que el next_btn pide la imagen actual + 1. Esto tiene sentido pero conseguir confundido con algo...
Tu ayuda será aprreciated.
Código: [ Select ]
import gs.*;
import gs.easing.*;
//---Load XML
var xmlPath = "photos.xml";
var photos_xml = new XML();
photos_xml.ignoreWhite = true;
var imageList:Array = new Array();
photos_xml.onLoad = function(success) {
if (success) { // ----------- load successful
// ----------- convert XML content to an array
imageList = photos_xml.firstChild.childNodes;
// ----------- Do some action once xml is loaded
loadImage();
// ----------- Do some action once xml is loaded
} else {
// ----------- problem loading, check path
trace("Error loading photos_xml");
}
}
//---Load Images
var currentImage:Number = 0;
var imageLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
imageLoader.addListener(loadListener);
loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number):Void {
TweenLite(dot)to(container_mc.background_mc, 1, {_width:target_mc._width + 20, _height:target_mc._height + 20, ease:Strong.easeOut});
TweenLite(dot)to(container_mc.border_mc, 1, {_width:target_mc._width, _height:target_mc._height, ease:Strong.easeOut});
TweenLite(dot)to(container_mc.mask_mc, 1, {_width:target_mc._width, _height:target_mc._height, ease:Strong.easeOut});
// center content
var clipXTarg = Math.round((Stage.width/2)-((target_mc._width+20)/2));
var clipYTarg = Math.round((Stage.height/2)-((target_mc._height+20)/2));
TweenLite(dot)to(container_mc, 1, {_x:clipXTarg, _y:clipYTarg, ease:Strong.easeOut});
// find previous image
if(currentImage == 0){
var prevImgNum = imageList.length -1;
}else{
var prevImgNum = currentImage -1;
}
var prevImg = container_mc.pics_mc["pic"+prevImgNum];
TweenLite(dot)to(prevImg, 1, {autoAlpha:0, onComplete:removePrevious});
}
loadListener.onLoadComplete = function(target_mc:MovieClip):Void {
TweenLite(dot)to(target_mc, 1, {autoAlpha:100, delay:1});
setTimer();
}
//---Functions List
function setTimer(){
timer = setInterval(loadImage, 5000);
}
function removePrevious(){
if(prevImg != undefined){
removeMovieClip(prevImg);
}
// increment the current image
if(currentImage < imageList.length -1){
currentImage = currentImage + 1;
}else{
currentImage = 0;
}
}
//Load the next image automatically
function loadImage(){
var loadURL = imageList[currentImage].attributes.imgurl;
var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+currentImage,container_mc.pics_mc.getNextHighestDepth());
targetClip._alpha = 0;
clearInterval(timer);
// load the new image
imageLoader.loadClip(loadURL,targetClip);
}
//Load the next image if the button was pressed
function loadImagePrevious() {
if(currentImage == 0){
var prevImgNum = imageList.length -1;
var loadURL = imageList[prevImg].attributes.imgurl;
var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+prevImg,container_mc.pics_mc.getNextHighestDepth());
targetClip._alpha = 0;
clearInterval(timer);
// load the new image
imageLoader.loadClip(loadURL,targetClip);
}else{
var prevImgNum = currentImage - 1;
var loadURL = imageList[prevImg].attributes.imgurl;
var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+prevImg,container_mc.pics_mc.getNextHighestDepth());
targetClip._alpha = 0;
clearInterval(timer);
// load the new image
imageLoader.loadClip(loadURL,targetClip);
}
}
//---On First Load
photos_xml.load(xmlPath);
stop();
//---Buttons
next_mc.onRelease = function() {
clearInterval(timer);
timer = setInterval(loadImage, 500);
pause_mc._visible = true;
play_mc._visible = false;
}
prev_mc.onRelease = function() {
clearInterval(timer);
????
pause_mc._visible = true;
play_mc._visible = false;
/*if(currentImage == 0){
var prevImgNum = imageList.length -1;
}else{
var prevImgNum = currentImage - 1;
}
var prevImg = container_people_mc.pics_mc["pic"+currentImageNumber];
TweenLite(dot)to(currentImage, 1, {autoAlpha:0, onComplete:removeCurrent});
*/}
- import gs.*;
- import gs.easing.*;
- //---Load XML
- var xmlPath = "photos.xml";
- var photos_xml = new XML();
- photos_xml.ignoreWhite = true;
- var imageList:Array = new Array();
- photos_xml.onLoad = function(success) {
- if (success) { // ----------- load successful
- // ----------- convert XML content to an array
- imageList = photos_xml.firstChild.childNodes;
- // ----------- Do some action once xml is loaded
- loadImage();
- // ----------- Do some action once xml is loaded
- } else {
- // ----------- problem loading, check path
- trace("Error loading photos_xml");
- }
- }
- //---Load Images
- var currentImage:Number = 0;
- var imageLoader:MovieClipLoader = new MovieClipLoader();
- var loadListener:Object = new Object();
- imageLoader.addListener(loadListener);
- loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number):Void {
- TweenLite(dot)to(container_mc.background_mc, 1, {_width:target_mc._width + 20, _height:target_mc._height + 20, ease:Strong.easeOut});
- TweenLite(dot)to(container_mc.border_mc, 1, {_width:target_mc._width, _height:target_mc._height, ease:Strong.easeOut});
- TweenLite(dot)to(container_mc.mask_mc, 1, {_width:target_mc._width, _height:target_mc._height, ease:Strong.easeOut});
- // center content
- var clipXTarg = Math.round((Stage.width/2)-((target_mc._width+20)/2));
- var clipYTarg = Math.round((Stage.height/2)-((target_mc._height+20)/2));
- TweenLite(dot)to(container_mc, 1, {_x:clipXTarg, _y:clipYTarg, ease:Strong.easeOut});
- // find previous image
- if(currentImage == 0){
- var prevImgNum = imageList.length -1;
- }else{
- var prevImgNum = currentImage -1;
- }
- var prevImg = container_mc.pics_mc["pic"+prevImgNum];
- TweenLite(dot)to(prevImg, 1, {autoAlpha:0, onComplete:removePrevious});
- }
- loadListener.onLoadComplete = function(target_mc:MovieClip):Void {
- TweenLite(dot)to(target_mc, 1, {autoAlpha:100, delay:1});
- setTimer();
- }
- //---Functions List
- function setTimer(){
- timer = setInterval(loadImage, 5000);
- }
- function removePrevious(){
- if(prevImg != undefined){
- removeMovieClip(prevImg);
- }
- // increment the current image
- if(currentImage < imageList.length -1){
- currentImage = currentImage + 1;
- }else{
- currentImage = 0;
- }
- }
- //Load the next image automatically
- function loadImage(){
- var loadURL = imageList[currentImage].attributes.imgurl;
- var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+currentImage,container_mc.pics_mc.getNextHighestDepth());
- targetClip._alpha = 0;
- clearInterval(timer);
- // load the new image
- imageLoader.loadClip(loadURL,targetClip);
- }
- //Load the next image if the button was pressed
- function loadImagePrevious() {
- if(currentImage == 0){
- var prevImgNum = imageList.length -1;
- var loadURL = imageList[prevImg].attributes.imgurl;
- var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+prevImg,container_mc.pics_mc.getNextHighestDepth());
- targetClip._alpha = 0;
- clearInterval(timer);
- // load the new image
- imageLoader.loadClip(loadURL,targetClip);
- }else{
- var prevImgNum = currentImage - 1;
- var loadURL = imageList[prevImg].attributes.imgurl;
- var targetClip = container_mc.pics_mc.createEmptyMovieClip("pic"+prevImg,container_mc.pics_mc.getNextHighestDepth());
- targetClip._alpha = 0;
- clearInterval(timer);
- // load the new image
- imageLoader.loadClip(loadURL,targetClip);
- }
- }
- //---On First Load
- photos_xml.load(xmlPath);
- stop();
- //---Buttons
- next_mc.onRelease = function() {
- clearInterval(timer);
- timer = setInterval(loadImage, 500);
- pause_mc._visible = true;
- play_mc._visible = false;
- }
- prev_mc.onRelease = function() {
- clearInterval(timer);
- ????
- pause_mc._visible = true;
- play_mc._visible = false;
- /*if(currentImage == 0){
- var prevImgNum = imageList.length -1;
- }else{
- var prevImgNum = currentImage - 1;
- }
- var prevImg = container_people_mc.pics_mc["pic"+currentImageNumber];
- TweenLite(dot)to(currentImage, 1, {autoAlpha:0, onComplete:removeCurrent});
- */}
Saludos
- Anonymous
- Bot


- Registrado: 25 Feb 2008
- Mensajes: ?
- Loc: Ozzuland
- Status: Online
Marzo 12th, 2012, 3:32 am
- ScottG
- Proficient


- Registrado: Jul 06, 2010
- Mensajes: 260
- Status: Offline
¿Vale?.... Como Im mirando este código la parte que todo el trabajo dosis siempre mira hacia atrás...mal explica...el siguiente código encuentra el movieclip el script creado por tomar la imagen actual y quitando 1 también cuando se llama a la función removePrevious también debajo quitar la imagen anterior y agrega a la imagen actual.
Lo único que puedo pensar con cabo cambiando completamente el código es a la inversa de la matriz de imageList y básicamente hacer una imagen siguiente funcionan como se hizo y la instalación de un intervalo definido para invertir atrás. NO bastante y no sé si funcionará correctamente con pruebas realmente aunque con fuera haciendo una recodificación sobre cómo cambiar las imágenes de su mejor puedo vengo con el momento.
ACTIONSCRIPT Código: [ Select ]
loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number):Void {
/*
I remove most of was not needed to show you
*/
// find previous image
if(currentImage == 0){
var prevImgNum = imageList.length -1;
}else{
var prevImgNum = currentImage -1;
}
var prevImg = container_mc.pics_mc["pic"+prevImgNum];
TweenLite(dot)to(prevImg, 1, {autoAlpha:0, onComplete:removePrevious});
}
/*
I remove most of was not needed to show you
*/
// find previous image
if(currentImage == 0){
var prevImgNum = imageList.length -1;
}else{
var prevImgNum = currentImage -1;
}
var prevImg = container_mc.pics_mc["pic"+prevImgNum];
TweenLite(dot)to(prevImg, 1, {autoAlpha:0, onComplete:removePrevious});
}
- loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number):Void {
- /*
- I remove most of was not needed to show you
- */
- // find previous image
- if(currentImage == 0){
- var prevImgNum = imageList.length -1;
- }else{
- var prevImgNum = currentImage -1;
- }
- var prevImg = container_mc.pics_mc["pic"+prevImgNum];
- TweenLite(dot)to(prevImg, 1, {autoAlpha:0, onComplete:removePrevious});
- }
Lo único que puedo pensar con cabo cambiando completamente el código es a la inversa de la matriz de imageList y básicamente hacer una imagen siguiente funcionan como se hizo y la instalación de un intervalo definido para invertir atrás. NO bastante y no sé si funcionará correctamente con pruebas realmente aunque con fuera haciendo una recodificación sobre cómo cambiar las imágenes de su mejor puedo vengo con el momento.
Página 1 de 1
Para responder a este tema que necesita para ingresar o registrarse. Es gratis.
Publicar Información
- Total de mensajes en este tema: 3 mensajes
- Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 48 invitados
- No puede abrir nuevos temas en este Foro
- No puede responder a temas en este Foro
- No puede editar sus mensajes en este Foro
- No puede borrar sus mensajes en este Foro
- No puede enviar adjuntos en este Foro
