Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

:: D.RAven..

[Resolvido] Falha em Galeria XML + FLASH (BNT NEXT/PREV)

Recommended Posts

Boa tarde pessoal,

 

Bom me desculpem se a duvida ou o problema seja simples de resolver pra vcs, mas eu to me matando com isso..

É o seguinte, fiz uma galeria xml + flash (na verdade estou adaptando o codigo de uma galeria q encontrei na net pq ainda n manjo construir uma e nem sei muito xml) e estou com um pequeno problema.. q pra mim esta se tornando imenso..

A galeria faz aparecer as miniaturas por xml, e adptei para que clicando na imagem menor, aparece a maior como se fosse em um shadow box feito com mc mesmo, até aí td bem, consigo fazer a imagem grande correta abrir no mc alvo mas n estou conseguindo construir alguma função para os botões next e prev pra q carregue a proxima ou a foto anterior no mesmo alvo..

 

segue os codigos:

 

function init()
{
    time_chk();
    right._visible = 1;
    right.ar.gotoAndPlay(1);
    _global.item_array = mx.xpath.XPathAPI.selectNodeList(feed_xml.firstChild, "/list/item");
    _global.user_flag = feed_xml.firstChild.attributes.user_flag;
    _global.interval = feed_xml.firstChild.attributes.interval;
    for (i = 0; i < item_array.length; i++)
    {
        item_array[i].pic = item_array[i].childNodes[0].firstChild.nodeValue;
        item_array[i].title = item_array[i].childNodes[1].firstChild.nodeValue;
        item_array[i].link = item_array[i].childNodes[2].firstChild.nodeValue;
        item_array[i].id = i;
    } // end of for
    p = 0;
    for (i = 0; i < item_array.length; i++)
    {
        it = items_mc.item.duplicateMovieClip("item" + i, i);
        it.pic.loadMovie(item_array[i].pic);
        it.txt.text = item_array[i].title;
        it.id = item_array[i].id;
        it.bg.onRollOver = function ()
        {
            if (!this._parent._parent._parent.moving)
            {
                this.gotoAndStop(2);
            }
        };
        it.bg.onRollOut = function ()
        {
            this.gotoAndStop(1);
        };
        it.bg.onRelease = function ()
        {
            if (!this._parent._parent._parent.moving)
            {
				//AO CLICAR NA IMAGEM THUMB [DANIEL SOARES - D.RAVEN]
				//AQUI ESTÃO AS ACTIONS Q ADICIONEI PARA ABRIR A IMAGEM NO ALVO
				_parent.shadow_box._visible = true;
				_root.nav_menu._alpha = 0;
				loadMovie(item_array[this._parent.id].link, _parent.big_image);
				
            }
        };
        if (i % 4 == 0)
        {
            it._x = p + 0;
        }
        else
        {
            it._x = p;
        }
        p = it._x + 125;
    }
}

feed_xml.onLoad = function (success)
{
    init();
};

Legal, o codigo esta funcionando normalmente, só estou com esse problema com os botôes next e prev q n estou conseguindo adicionar +1 ao valor carregado quando cliquei na miniatura.. e pelas tentativas que fiz aqui, o maximo que consegui foi dar um "undefined" ao clicar nos botões e n saí disso..

Alguém por favor me ajude a fazer os botões de next e prev q é a unica coisa q falta.. ja tentei procurar em tutoriais, forums e ate mesmo em templates mas n consegui desvendar o misterio.. pq pra mim ainda é misterio criar essas funções.. já n consigo mais pensar..

 

Obrigado pela atenção de vcs desde já..

Compartilhar este post


Link para o post
Compartilhar em outros sites

Faça os ajustes com os comentários que fiz abaixo criando os botões para adiantar e voltar que deve funcionar.

 

abraço

 

function init() 
{ 
    time_chk(); 
    right._visible = 1; 
    right.ar.gotoAndPlay(1); 
    _global.item_array = mx.xpath.XPathAPI.selectNodeList(feed_xml.firstChild, "/list/item"); 
    _global.user_flag = feed_xml.firstChild.attributes.user_flag; 
    _global.interval = feed_xml.firstChild.attributes.interval; 
    for (i = 0; i < item_array.length; i++) 
    { 
        item_array[i].pic = item_array[i].childNodes[0].firstChild.nodeValue; 
        item_array[i].title = item_array[i].childNodes[1].firstChild.nodeValue; 
        item_array[i].link = item_array[i].childNodes[2].firstChild.nodeValue; 
        item_array[i].id = i; 
    } // end of for 
    p = 0; 
    for (i = 0; i < item_array.length; i++) 
    { 
        it = items_mc.item.duplicateMovieClip("item" + i, i); 
        it.pic.loadMovie(item_array[i].pic); 
        it.txt.text = item_array[i].title; 
        it.id = item_array[i].id; 
        it.bg.onRollOver = function () 
        { 
            if (!this._parent._parent._parent.moving) 
            { 
                this.gotoAndStop(2); 
            } 
        }; 
        it.bg.onRollOut = function () 
        { 
            this.gotoAndStop(1); 
        }; 
        it.bg.onRelease = function () 
        { 
            if (!this._parent._parent._parent.moving) 
            { 
                                //AO CLICAR NA IMAGEM THUMB [DANIEL SOARES - D.RAVEN] 
                                //AQUI ESTÃO AS ACTIONS Q ADICIONEI PARA ABRIR A IMAGEM NO ALVO 
                                _parent.shadow_box._visible = true; 
                                _root.nav_menu._alpha = 0; 
								
								// chama a foto de acordo com o id de cada thumb
								_global.idFoto = this._parent.id;
								carregarFoto();
                                 
            } 
        }; 
        if (i % 4 == 0) 
        { 
            it._x = p + 0; 
        } 
        else 
        { 
            it._x = p; 
        } 
        p = it._x + 125; 
    } 
} 
// função para carregar a foto
function carregarFoto()
{
	//acertar aqui o caminho de _parent.big_image
	loadMovie(item_array[_global.idFoto % item_array.length].link, _parent.big_image);
}
// função para puxar a próxima foto
function nextFoto()
{
	_global.idFoto ++;
	carregarFoto()
}
// função para puxar a foto anterior
function prevFoto()
{
	_global.idFoto --;
	carregarFoto()
}

//actions para os botões de prev e next

btNext.onRelease = function()
{
	nextFoto();
}
btPrev.onRelease = function()
{
	prevFoto();
}
 
feed_xml.onload = function (success) 
{ 
    init(); 
};

Compartilhar este post


Link para o post
Compartilhar em outros sites

carneirinho

 

Perfeito cara!!! Funcionou certinho..

Tenho q estudar mais sobre essas classes _global e outras mais..

To começando agora cara!!! Ainda tenho muito que aprender..

 

MUITOOO OBRIGADO MESMOOO..

 

Só falta agora eu fazer uns ajustes, botão fechar, transições entre imagens, essas coisas..

 

Assim que eu finalizar, e se claro eu n precisar de mais alguma ajuda.. rsrsrs.. eu posto a galeria completa aki.. se caso alguém mais precisar.. ja sabe de uma que funciona, rsrs..

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.