I want to combine various setIntervals.
The main Interval (10 sec) calls the function that loads the images.
What I want is to call another Interval (2.5sec) that calls a function that rotate the images (+90 degrees).
Here is the code:
// comando para fullscreen
fscommand("fullscreen", "true");
fscommand("allowscale", "false");
// funcao que attacha mc_loadimg e carrega img
function loadimg () {
var f1 = random(165) + 1;
//f2 = random(48) + 1;
loadMovie(f1 + ".jpg", "_root.conjunto.foto1");
loadMovie(f1 + ".jpg", "_root.conjunto.foto2");
loadMovie(f1 + ".jpg", "_root.conjunto.foto3");
loadMovie(f1 + ".jpg", "_root.conjunto.foto4");
trace ("img# = " + f1);
}
function rotateimg () {
_root.conjunto.foto1._rotation = 90;
_root.conjunto.foto1._x = _x + 300;
_root.conjunto.foto2._rotation = 90;
_root.conjunto.foto2._x = _x + 310;
_root.conjunto.foto3._rotation = -90;
_root.conjunto.foto3._x = _x + 300;
_root.conjunto.foto4._rotation = -90;
_root.conjunto.foto4._x = _x + 310;
trace ("function rotateimg OK");
}
//run the function initially
loadimg();
//use setInterval to run it every 5 seconds after that
setInterval(loadimg, 5000);
setInterval(rotateimg, 2500);
The crazy math that I did is because I reflected the movieclips, so I have to set their _x position after rotating the mcs.
img# = 6
function rotateimg OK
img# = 69
function rotateimg OK
function rotateimg OK
img# = 94
function rotateimg OK
function rotateimg OK
img# = 145
function rotateimg OK
The function rotateimg is called. This is ok, but the images do not rotate.
just in the first call. Is there a way to rotate a movieclip according to its center? I want them to rotate but stays in the same position!
If this is not too much… create 3 imgs, named 1.jpg untill 3.jpg, 300x300px and put them in the same .swf file`s folder. They should rotate at first call, but when a new image is loaded, it does not rotate anymore.
Thanks
I have a lot of doubts on this thread.
First of all, here is my .fla.
I have on the stage (610x610px) four movieclips that resides the same loaded image.
But I modified them a little bit.
mc1(0,0) - no modification
mc2(610,0) - one flip horizontal
mc3(610,610) - one flip horizontal and one flip vertical
mc4(0,610) - one flip vertical
!!! The registration point of the mc is the upper left!!!
Thats why I had to fix their position on the stage after setting the flips.
And also on the function rotateimg I had to do this.
So I think I will have to set their center position after the image is loaded, correct? What I have to do? Just put the code after the loadMovie commands?
I was looking at the code and realized that this is worst than I thought.
If I set the x_scale and y_scale to -100, the image will appeear in a different position. I really need to set their center position to the center of the image, so I could rotate and flip whenever I need. Is this possible using only actionscript?
I get an unexpected file type error when opening your file. If you are on a mac you need to .zip it.
And the link I posted in my last post showed you exactly how to center your loaded content. Sure that used a dynamically loaded .jpg, but the same method goes for any dynamically loaded content.