-
help with slideshow
hi
i have a slide show example
http://www.flashkit.com/movies/Inter...2087/index.php
the client ask to me if in this menu is possible stop in each image with mouseover
i think this is not possible, but i don't know so much about actionscript
i´m sorry for my english
por si alguien sabe español lo explico asi
el cliente me pide un menu como esta en el ejemplo
pero dice que quiere que cada vez que se hace un mouseover sobre la imagen se detenga para que no "maree"
no se si es posible que se detenga la imagen precisamente porque la idea es que no pare (es decir se detiene en un eje central, pero no en cada imagen)...pero a lo mejor se puede hacer que cada imagen tenga un eje o area donde se detenga
muchas gracias
y buena vida
lapola
-
http://www.in3d.eu
Hi,
Although a lot of days from the first post.. maybe this is still useful (possibly to other people):
1) Download the .zip file wich contains the .fla file of that gallery
2) Open the .fla project file in flash
3) Open the Library if not visible (Ctrl+L)
4) Locate in Library a movie clip named: "p2_imgSlider_mc" and double click to open its timeline
5) In the first layer named "actions", click the frame 1 (keyframe) of timeline and then press the "F9" key to launch the Action script panel (or right click this frame and select "Actions")
6) Once open the AS panel, select all code which is inside, and replace it with the following slight variation:
(AS) code (the changes are not many, however is not so easy to explain where each of them should be located.. So just replace the whole code):
PHP Code:
stop();
//Setup////////////////////////////////////////
//totalclips on stage - make sure in the properties panel they are named imgbox1,imgbox2,imgbox3,etc...
var totalClips = 6;
//to stop the clips from moving change to true;
var holdPosition = false;
//applies a max speed for the movie clips (false if no max speed)
var maxSpeed = false;
///////////////////////////////////////////////////
//Defaults
var slideSpeed = 0.1;
var currentMousex = 0;
var clipBaseName = 'imgbox';
var w_clips = this[clipBaseName + '1']._width+2;
var totalWidth = (totalClips * w_clips);
var maxleft = imgbox1._x;
var maxright = (totalWidth/2);
//--
var OverFlag=false
function Stop(){
OverFlag=true
}
onEnterFrame = function(){
if (OverFlag) return
currentMousex = Math.floor(this._xmouse);
if(maxSpeed != false) currentMousex = (currentMousex >= maxSpeed)? maxSpeed : -maxSpeed;
//-----------------------------------------
if(!holdPosition){
for(i=0;i <= totalClips; i++){
var tmpObj = this[clipBaseName + i];
tmpObj.onRollOver=function(){
//OverFlag=true
setTimeout(Stop,80)
}
tmpObj.onRollOut=function(){
OverFlag=false
}
tmpObj._x = Math.floor(tmpObj._x-(currentMousex*slideSpeed));
if(tmpObj._x <= maxleft){tmpObj._x += totalWidth;}
if(tmpObj._x >= maxright){tmpObj._x -= totalWidth;}
}
}
}
7) Run the movie (if everything is OK, then the animation will stop when mouse over and continues on mouse out -RollOut- )
Regards!
Kostas
Last edited by Kostas Zotos; 05-11-2008 at 11:14 AM.
-
thank you very much Kostas
works perfectly
-
http://www.in3d.eu
Your welcome
By the way an optimized code version is here
(it's more efficient-consumes less resources. I recommend to use this version instead of the code given in the previous post):
AS code:
PHP Code:
stop();
//Setup////////////////////////////////////////
// USE: true to stop animation on RollOver OR: false (not stop)
var StopAnimation=true
// USE: true if want hand cursor onRollOver clips OR: false (no hand cursor)
var HandCursor=false
//totalclips on stage - make sure in the properties panel they are named imgbox1,imgbox2,imgbox3,etc...
var totalClips = 6;
//to stop the clips from moving change to true;
var holdPosition = false;
//applies a max speed for the movie clips (false if no max speed)
var maxSpeed = false;
///////////////////////////////////////////////////
//Defaults
var slideSpeed = 0.1;
var currentMousex = 0;
var clipBaseName = 'imgbox';
var w_clips = this[clipBaseName + '1']._width+2;
var totalWidth = (totalClips * w_clips);
var maxleft = imgbox1._x;
var maxright = (totalWidth/2);
//--
//----------- This code section stops animation when mouse rollOver clips ------------
var OverFlag=false
var TimeOutID
function Stop(){OverFlag=true}
for(i=0;i <= totalClips; i++){
var tmpObj = this[clipBaseName + i];
tmpObj.useHandCursor=HandCursor
tmpObj.onRollOver=function(){
//OverFlag=true
if (StopAnimation) TimeOutID=setTimeout(Stop,66)
}
tmpObj.onRollOut=function(){
if (StopAnimation){
clearTimeout(TimeOutID)
OverFlag=false
}
}
}
//--------------- End of: on Mouse RollOver stop animation ----------------------------
onEnterFrame = function(){
if (OverFlag) return // Stops animation if mouse RollOver clips
currentMousex = Math.floor(this._xmouse);
if(maxSpeed != false) currentMousex = (currentMousex >= maxSpeed)? maxSpeed : -maxSpeed;
//-----------------------------------------
if(!holdPosition){
for(i=0;i <= totalClips; i++){
var tmpObj = this[clipBaseName + i];
tmpObj._x = Math.floor(tmpObj._x-(currentMousex*slideSpeed));
if(tmpObj._x <= maxleft){tmpObj._x += totalWidth;}
if(tmpObj._x >= maxright){tmpObj._x -= totalWidth;}
}
}
}
In the above code there is also a variable named "StopAnimation", which you may use to easily toggle between stop animation onRollOver or not (now is true which means the animation will stopped on mouse over):
Just locate the next 2 lines (almost on top of code) in the previous code and change the value to "true" (as it is now, so that the animation stopped on roll over. If don't want this behavior you can change the value to: "StopAnimation=false")
Code:
// USE: true to stop animation on RollOver OR: false (not stop)
var StopAnimation=true
Cheers!
Kostas
Last edited by Kostas Zotos; 05-12-2008 at 02:54 PM.
-
You are god !!!!!!!!!!!!!!!!!!!!!
INCREDIBLE IT WORKS !!! with so LITTLE lines of Code !!!!
I have search the whole internet for this, and believe me I have found so much complicated things !!! But this.. this is great !!
Just what I was looking was the option to be able to load movieclips by themselves, not just pictures. In every movieclip I can now place a loader with a photo and a button for opening a detailed view of the product.
Just a question, I am using the gallery with the option StopAnimation=false (so when the I RollOut the animation does NOT stop)
I saw in you text that when you use "StopAnimation=true" the gallery will STOP when you "RollOver" the gallery and will start to move again when you "RollOut" from it.
I want it to do EXACTLY the opposite. When you "RollOver" the gallery, I want it to move and when you "RollOut" from it, I want it to STOP.
I hope you can help me doing this. You have no idea how helpfull you are !!
Thank you so much for you nice help !!!
Eduardo Rivero.
Code:
In case you want to write me directly: xeikon_mind@hotmail.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|