Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2008



Tip: Looking for answers? Try searching our database.

Interactive gallery

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
elechal23 - 03 Jul 2008 00:34 GMT
I am using this pic gallery from this link:
http://www.flasheezy.com/flash_file/4-XML-gallery-3 but I needed to make some
modifications to it. I made the document size smaller and changed the
background color. The pictures are going off of the document and the user
cannot see them. It is random, here is the site I?m working on:
www.levelgraphics.biz/4colorfoil/gallery If someone can please take a loot at
it and let me know what I can do to fix this, I would really appreciate it!! I
looked through the action script but I couldn?t find anything?not too familiar
with it =/

Thanks in advance!
Rob Dillon - 03 Jul 2008 14:17 GMT
Each of those images is animating across the screen using a timeline animation
or actionscript. So, you need to either change the timeline for each animation,
or you need to change the end point of each animation in the actionscript.

If this is using actionscript then it is probably setting the end points as a
random value based on the original size of the stage. Look for a line of
actionscript that includes "Math.random()". There will probably be a multiplier
number there. Make that number smaller to reflect your new stage size.
elechal23 - 10 Jul 2008 23:36 GMT
Hi Rob,

Thanks a lot for your reply, I found the "Math.random()" and I tried taking
off the * on the side that it has and adding numbers to it but it didn't work,
it has an extra piece of code on the side that if I remove it, the pictures
don't show up. Here is it...

function randRange(min:Number, max:Number):Number {
    var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
    return randomNum;

There is A LOT of action script in here that just keeps going and going so I
don't know what other parts I would have to change. My document size is 290
tall by 463 wide. There are 2 layers and the code above is on the second layer
toward the bottom. I attached the codes and but a big space between the 2
layers. If you can please help me further I would be extremely grateful!!!!

Elenis

Stage.scaleMode = "Stage.size";
//fscommand("showmenu", "false");
fscommand("fullscreen", "true");
Stage.align = "TC";
stop();
musica.loadMovie("player.swf",97);
musica._visible=false;
_root.mask.visible = false;
_root.mask.lock.enabled=false;
loading_mc.onEnterFrame = function() {
    var bLoaded = _root.getBytesLoaded();
    var bTotal = _root.getBytesTotal();
    var Porcent = Math.round(bLoaded/bTotal*100);
    this.texto_txt.text = Porcent+"%";
    loadSombra_mc.texto_txt.text = Porcent+"%";
    if (Porcent>=100) {
        nextFrame();
        this.alphaTo(0, 1);
        loadSombra_mc.alphaTo(0, 1);
    }
};

//System.security.loadPolicyFile("http://webmidiadigital.com.br/ffiles/crossdoma
in.xml");

#include "mc_tween2.as"
sfondo._alpha=0;
sfondo.alphaTo(100,5);
logo.menu.loadMovie("activateMenu.swf",99);
musica._visible=true;
_global.verticale="";
function ridim() {
    back._width = Stage.width;
    back._height = Stage.height;
    mask._width = Stage.width;
    mask._height = Stage.height;
}
var sl:Object = new Object();
sl.onResize = function() {
    ridim();
};
Stage.addListener(sl);
sl.onResize();
ridim();

//----------------------- Declarando Variaveis ----------------------------
//Importando Classe Tween
click = false;
lock = false;
#include "mc_tween2.as"
//Criando objeto XML :)
var Galeria:XML = new XML();
//Declarando que é para ignorar espaços em branco da Galeria
Galeria.ignoreWhite = true;
//Criando Array para receber o conteudo do XML
var Dados:Array = new Array();
//Criando Variavel para que recebera o numero de fotos
var Quantidade:Number = 0;
//Criando Variavel da Classe MovieCLipLoader
var CarregaThumb:MovieClipLoader = new MovieClipLoader();
//Crinado Varivael para carregar as Fotos Grandes ()
var CarregaBig:MovieClipLoader = new MovieClipLoader();
//Criando Objeto para trabalhar como listner da classe a cima
var thumbListener:Object = new Object();
//Criando Objeto para trabalhar como listner da classe a cima2
var bigListener:Object = new Object();
//Variavel para Indicar o carregamento de cada imagen
var Carregada:Number = 0;
//Variavel pra Mostrar Quantos ja Forão Abertos
var Prontos:Number = 0;
//Variavel pra dizer se alguma foto esta aberta na tela
var Aberto:Boolean = false;
//Escontendo barra de Carregamento
loaderBar_mc._alpha = 0;
//-------------------------------------------------------------------------
//----------------------- Handlers ----------------------------------------
//Quando Carregar a Galeria
Galeria.onLoad = function() {
    //Atribuindo a Variavel Quantidade Criada Anteriormente para o numero de
objetos no XML
    Quantidade = Galeria.firstChild.childNodes.length;
    //Insirindo os dados do XML na array criada anteriormente
    Dados = this.firstChild.childNodes;
    //Chamando a Função para começar o tcha thca thca
    CriaThumbs();
};
//Listner para quando o carregamento começar
thumbListener.onLoadStart = function(alvo_mc:MovieClip) {
    loaderBar_mc.alphaTo(100, 1, "easeOutQuad");
};
thumbListener.onLoadInit = function(alvo_mc:MovieClip) {
    alvo_mc.Larg = alvo_mc._width;
    alvo_mc.Altu = alvo_mc._height;
};
thumbListener.onLoadProgress = function(alvo_mc:MovieClip, bytesLoaded:Number,
bytesTotal:Number) {
    var Percent = bytesLoaded/bytesTotal*100;
    loaderBar_mc._xscale = Percent;
};
thumbListener.onLoadComplete = function(alvo_mc:MovieClip) {
    Carregada++;
    CriaThumbs();
    posicionaThumb(alvo_mc);
    loaderBar_mc.alphaTo(0, 1, "easeOutQuad");
};
//
bigListener.onLoadComplete = function(Final:MovieClip) {
    fotoGrande_mc.mascara_mc.yScaleTo(100, 5, "easeOutQuad");
    fotoGrande_mc.porcent_txt.text = _root.Legenda;
    fotoGrande_mc.anno_txt.text = _root.anno;
    fotoGrande_mc.titolo_txt.text = _root.titolo;
    fotoGrande_mc.misura_txt.text = _root.misura;
    fotoGrande_mc.verticale_txt.text = _root.verticale;
    //trace(_root.Legenda);
};
//
bigListener.onLoadProgress = function(alvo_mc:MovieClip, bytesLoaded:Number,
bytesTotal:Number) {
    var Percent = Math.round(bytesLoaded/bytesTotal*100);
    alvo_mc._parent.porcent_txt.text = Percent+"%";
};
//-------------------------------------------------------------------------
//----------------------- Funções -----------------------------------------
//Função que Cria os Thumbs
function CriaThumbs() {
    if (Carregada<Quantidade) {
        duplicaThumb();
    }
}
//Função para Criar +1 i thumb
function duplicaThumb() {
    //Duplicamos o Thumb
    Thumb_mc.duplicateMovieClip("Thumb"+Carregada+"_mc", Carregada);
    //Movemos ele para posições randomicas
    this["Thumb"+Carregada+"_mc"]._x = random(463)*-1;
    this["Thumb"+Carregada+"_mc"]._y = random(290)*-1;
    carregaEsseThumb(this["Thumb"+Carregada+"_mc"]);
}
//Função para Carregar a Foto no Lugar Certo do Thumb
function carregaEsseThumb(Aonde:MovieClip) {
    //Atribuindo a Foto Pequena para um parametro dentro do Movie
    Aonde.pqn = Dados[Carregada].attributes.pqn;
    //Atrigundo foto grande
    Aonde.gde = Dados[Carregada].attributes.gde;
    //Atribuindo legenda
    Aonde.legenda = Dados[Carregada].attributes.legenda;
   
    Aonde.titolo = Dados[Carregada].attributes.titolo;
    Aonde.misura = Dados[Carregada].attributes.misura;
    Aonde.anno = Dados[Carregada].attributes.anno;
    Aonde.verticale= Dados[Carregada].attributes.verticale;
   
    CarregaThumb.loadClip(Aonde.pqn, Aonde.recebe_mc);
}
function posicionaThumb(Qual:MovieClip) {
    Qual._parent.tween(["_x", "_y", "_rotation"], [randRange(290, 463),
randRange(290, 463), random(360)], 2, "easeOutQuad");
    Qual._parent.onRollOver = function() {
        if (!Aberto) {
            desombraMe(this);
           
        }
       
    };
    Qual._parent.onPress = function () {
       
        if (!Aberto) {
            //this.swapDepths(Quantitade);
            Qual._parent.startDrag();
            this.scaleTo(130,0.04,"easeOutQuad");
            sombraMe(this);
           
        }
        //if this is the first click
        if (!_root.click) {
           
            timer = getTimer()/1000;
           
            _root.click = true;
        }
        else {
            timer2 = getTimer()/1000;
            //if it is a double click
            if ((timer2-timer)<.25) {
                Qual._parent.stopDrag();
               
                if (!Aberto) {
                    Abre(this);
                    _root.mask.visible=true;
                    _root.mask.alphaTo(75, 0.5, "easeOutQuad");
                    _root.mask.swapDepths(_root.getNextHighestDepth())
                    Aberto = true;
                }
                else if (Aberto) {
                   
                    fecha(this);
                    Aberto = false;
                    desombraMe(this);
                    _root.mask.alphaTo(0, 0.4, "easeOutQuad");
                    _root.mask.swapDepths(1);
                    _root.click=false;
                   
                }
            }
            else {
                    timer = getTimer()/1000;
                    _root.click = true;
            }
        }
    }
    Qual._parent.onRelease = function () {
       
        Qual._parent.stopDrag();
        angle=getProperty(Qual._parent,_rotation);
        if (!Aberto) {
        Qual._parent.scaleTo(100,0.1,"easeOutQuad");
        desombraMe(this);
        Qual._parent.tween(["_rotation"], [angle+randRange(-5,5)], 0.5,
"easeOutQuad");
   
        }
    }
    Qual._parent.onRollOut = function() {
        if (!Aberto) {
            //Qual._parent.scaleTo(100,0.2,"easeOutQuad");
            desombraMe(this);
        }
    };
   

}
//Função para retornar um numero randomico, mais passando um range
function randRange(min:Number, max:Number):Number {
    var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
    return randomNum;
}
//
onEnterFrame = function () {
    //Texto Completo
    parcial_txt.text = Carregada+" / "+Quantidade;
};
function sombraMe(Movie:MovieClip) {
    Movie.alphaTo(100, 0.002, "easeOutQuad", 0.002, swapa);
    ////
}
function desombraMe(Movie:MovieClip) {
    Movie.frameTo(1, 0.5, "easeOutQuad");
    fechaTollTip();
}
//
function swapa() {
    this.alphaTo(100, 0.0002, "easeOutQuad");
    //this.swapDepths(Quantidade);
    this.swapDepths(_root.getNextHighestDepth());
    this.frameTo(15, 0.005, "easeOutQuad");
}
//
function Abre(Qual) {
    if (!Aberto) {
        Qual.scaleTo(240, 0.5, "easeOutQuad");
trace(Qual.verticale);
        if (Qual.verticale=="true")   
        {Qual.tween(["_x", "_y", "_rotation"], [400, 100, 90], 0.5, "easeOutQuad",
0, carregaFoto);
        _global.verticale="true";
        }
        if (Qual.verticale=="false")
        {Qual.tween(["_x", "_y", "_rotation"], [10, 100, 0], 0.5, "easeOutQuad", 0,
carregaFoto);
        _global.verticale="false";
        }
        _root.Legenda = Qual.legenda;
        _root.anno=Qual.anno;
        _root.misura=Qual.misura;
        _root.titolo=Qual.titolo;
        _root.verticale=Qual.verticale;
       
    }
}
//
function fecha(Qual:MovieClip) {
    fechaFoto();
    Qual.scaleTo(100, 0.5, "easeOutQuad");
    Qual.tween(["_x", "_y", "_rotation"], [random(463), random(290),
random(360)], 0.5, "easeOutQuad");
    _root.Legenda = "";
   
}
//
function carregaFoto() {
    fotoGrande_mc.mascara_mc._yscale = 0;
    fotoGrande_mc._x = 22;
    fotoGrande_mc._y = 22;
    fotoGrande_mc.recebe_mc._x = 0;
    fotoGrande_mc.recebe_mc._y = 90;
    if (_global.verticale=="true"){
    fotoGrande_mc.recebe_mc.rotateTo(90);
    fotoGrande_mc.recebe_mc._x = 365;
    fotoGrande_mc.recebe_mc._y = 90;
    }
    fotoGrande_mc.swapDepths(_root.getNextHighestDepth());
    CarregaBig.loadClip(this.gde, fotoGrande_mc.recebe_mc);
}
function fechaFoto() {
    trace("fdsfdsf");
    //_root.logo.slideTo((Stage.width/2),10,4);
   
    _root.ombra.swapDepths(_root.getNextH
Rob Dillon - 11 Jul 2008 23:42 GMT
Here's one function that uses the random function, an older version, not
Math.random:
//Função para Criar +1 i thumb
function duplicaThumb() {
    //Duplicamos o Thumb
    Thumb_mc.duplicateMovieClip("Thumb"+Carregada+"_mc", Carregada);
    //Movemos ele para posições randomicas
    this["Thumb"+Carregada+"_mc"]._x = random(463)*-1;
    this["Thumb"+Carregada+"_mc"]._y = random(290)*-1;
    carregaEsseThumb(this["Thumb"+Carregada+"_mc"]);
}

I have no idea what's going on here, but the random function is used to set a
random x and y position for a movieClip, I'm guessing its a thumbnail. These
numbers here, 463 and 290, could be changed to smaller values and then see if
the positioning is better.

This chunk of code further down:
function posicionaThumb(Qual:MovieClip) {
    Qual._parent.tween(["_x", "_y", "_rotation"], [randRange(290, 463),
randRange(290, 463), random(360)], 2, "easeOutQuad");
    Qual._parent.onRollOver = function() {
        if (!Aberto) {
            desombraMe(this);
           
        }
       
    };

looks like it may also have something to do with the positioning or the
animation of the photos.

Hope this helps.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.