Hi,
I'm trying to understand this scroller and make it so I can click on an image and it'll animate getting bigger and then some text appearing. The animation isn't a problem it's just understanding the code and getting it to work as I need.
I had a go at putting a button on a MC and trying to tell it to jump the root/main timeline to frame 5 but it didn't seem to work. I also had a go at trying to make it jump to frame 5 of the movie clip but this also didn't work. It appears the code is stopping me from doing anything with this as it opens a large version of the img u click on underneath which is not what I need.
I have two files here. 1 is the problem I'm talking about above the other is a scroller which I just need to know how to loop continuasly.
code
first file code on main timeline
PHP Code:
/*
/ * HORIZONTAL SCROLL CONTINUOUS Flash
is not necessary to redimensionar imagenes, are
autoajustan. To mount each image in a MC for
attach and to tie them with names MC1, MC2,
MC3...... etc. To define the beginning
variables seg?necesidad.
*/
Nmcs = 11;// number of MC.s for scrolling
espacio = 10;//space that is left between the photos
Xc = 5;//coordinate x of the box of scroll
Yc = 5;//coordinate y of the box of scroll
Xo = 10;// co-ordinated x origin viewfinder
Yo = 135;// co-ordinated y origin viewfinder
Xf = 797;// co-ordinated extreme x viewfinder (wide Xo +)
Yf = 570;// coordinate and end viewfinder (high I =)
alturamax = 90;//in order to reescalar if the image is but high
anchmax = 793;//in order to reescalar if the image is but high
velo = velobase=1;//speed bases pos or neg
ajuste = false;//true: it equals the stops to alturamax
aleatorio = true;// false: nonrandom loading
bandapelicula = true; // false to clear cinema band
//end of beginning variable
fondo._visible= false;
cl=new Array(0x000000,0x0000ff,0xff0000,0xffffff);
barajar(Nmcs);
examples();// delete this line to use the application
function examples() {// delete this line to use the application
createEmptyMovieClip("imgMC", 1);
imgMC._y = Yc;
actual = 0;
anchomas = 0;
altomas = 0;
mc = [];
A = Nmcs*2;
for (k=0; k<A; k++){
mc[k] = imgMC.attachMovie("MC"+bar[k%Nmcs],"MC"+bar[k%Nmcs],100+k);
with (mc[k]){
_x = actual;
_y= 15;
if (_height>alturamax || ajuste){
_yscale = alturamax*100/_height;
_xscale = _yscale;
}
_width>anchomas ? anchomas=_width : null;
_height>altomas ? altomas=_height : null;
actual += _width+espacio;
}
}
actual/2>anchmax ? anchura=anchmax : anchura=actual/2;
mc[A] = createEmptyMovieClip("m",0);
marco(A,Xo,Yo,Xf,Yf,5,cl[0],cl[0],8);
mc[A+2]=imgMC.createEmptyMovieClip("mascara",199);
marco(A+2,0,0,anchura,altomas+30,5,0,cl[3],20);
imgMC._x = Xc-anchomas;
bandapelicula ? bandafilm(): null;
imgMC.mascara._x = anchomas;
imgMC.setMask(imgMC.mascara);
onEnterFrame = function (){
for (k=0; k<Nmcs*2; k++){
with (mc[k]){
_x += velo;
_x-actual>=velo ? _x -= actual : null;
_x<=0 ? _x += actual : null;
condicion(k) ? borde(k) : mc1.removeMovieClip();
}
}
mc[A+5]._x=(mc[A+5]._x+ velo)%25 ;
}
function borde(k) {
mc[A+3]=mc[k].createEmptyMovieClip("mc1", 201);
marco(A+3,5,5,mc[k]._width-5,mc[k]._height-5,2,0xfff00,0xff0000,10);
mc[A+3]._xscale = 10000/mc[k]._xscale;
mc[A+3]._yscale = 10000/mc[k]._yscale;
activo = k;
}
function mmin() {
velo = 0;
xm = _xmouse;
imgMC.mascara.onMouseMove = function() {
if (Math.abs(xm-_xmouse)>30) {
velo = (Xc+imgMC.mascara._width/2-_xmouse)/20;
actpress = false;
}
};
}
function condicion(k) {
with (mc[k]) {
return (_width*100/_xscale>_xmouse && _xmouse>0
&& _height*100/_yscale>_ymouse && _ymouse>0
&& imgMC.mascara._width>imgMC.mascara._xmouse
&& imgMC.mascara._xmouse>0);
}
}
imgMC.mascara.onPress = function() {
velo = 0;
entra = true;
actpress && condicion(activo) ? openimg(activo) : null;
delete imgMC.mascara.onMouseMove;
};
imgMC.mascara.onRelease = function() {
mmin();
entra = false;
actpress = true;
};
imgMC.mascara.onRollOut = function() {
velobase * velo>=0 ? velo=velobase: velo=-velobase;
delete imgMC.mascara.onMouseMove;
};
imgMC.mascara.onRollOver = function() {
mmin();
};
}//aim of examples delete this line to use the application
function barajar(clips) {
bar = [];
for (var m = 0; m<clips; m++) {
bar[m] = m;
}
if (aleatorio) {
for (var i = clips-1; i>0; i--) {
alea = Math.floor(i*Math.random());
var temp = bar[i];
bar[i] = bar[alea];
bar[alea] = temp;
}
}
}
function openimg(k) {
if (entra) {
_root.attachMovie("MC"+(bar[k%Nmcs]), "vista", 220);
boton.enabled = false;// delete to use the application
boton._visible = false;// delete to use the application
vista._width = Xf-Xo-3;
vista._yscale = vista._xscale;
if (vista._height>Yf-Yo-3) {
vista._height = Yf-Yo-3;
vista._xscale = vista._yscale;
}
vista._x = Xo+(Xf-Xo-vista._width)/2;
vista._y = Yo+(Yf-Yo-vista._height)/2;
vista.onPress = function() {
vista.removeMovieClip();
boton.enabled = true;// delete to use the application
boton._visible = true;// delete to use the application
}
}
!entra ? (vista.removeMovieClip()): null;
}
//delete the following function to use the application
boton.onPress = function() {
mc[A].removeMovieClip();
texto._visible = false;
Nmcs = 1+random(11);
espacio = random(30);
Xc = 10*random(15);
Yc = 10*random(15);
alturamax = 30+10*random(20);
anchmax = 190+20*random(30);
velo = velobase=2+random(2);
Xo = Xc;
Yo = alturamax+Yc+35;
Xf = 795-Xc;
Yf = 595;
ajuste = !ajuste;
bandapelicula = true*(random(5)>=2)
barajar(11);
examples();
cl[3]=0xffffff;
cl[0]=0x000000;
fondo._visible= false;
if (random(5)==1){ cl[0]=0xffffff;cl[3]=0x000000;fondo._visible= true;}
if (random(5)==1){ cl[0]=0x0000ff;cl[3]=0xffffff;fondo._visible= true;}
};
/*
In order to use the application to erase or to
pass to commentaries the indicated lines. To
eliminate layer 2 of the scene and the
button of the library.
*/
stop();
and on my 2nd file on the image/MC that scrolls...