PDA

View Full Version : Resizing Movieclips spacing (F5)


Slowburn
05-09-2003, 03:56 PM
Hello Everyone,

Uh, I need some help building this mini module for a site.

I have a stage 420x50

and I have 4 Movieclips about, lets say, 85x50, spaced out to fit the stage.

These movieclips expand to about 210x50 when you rollover them.

The effect I need to achieve is when the movieClip expands, I need the other to move with the one that is expanding but the last one cannot go past the stage, however, the others can overlap slightly.

I would need to do this on both sides, depending on which MovieClip you rollover.

So having 4 MC's, and you rollOver #2, then #1 should slide to the left, and #3-4 should slide to the right.

Any help would be appreciated.

This needs to be Flash 5, syntax.

Thank you.

emergency_pants
05-12-2003, 05:18 PM
how about planning the movie sizes so they fit snugly?

If your stage is 420 wide and you have 4 movies. When one movie is active, it expands in width... right?

So... how about making each of your movies 84 pixels wide. This is effectively 420/5. It gives you space for one more movie.... which would be the space that the active movie takes up. So that an active movie is twice the width of a non-active movie. That gives you 420 pixels and you don't need to worry about overlapping and making a movieClip partially leave the stage.

Then, logically, any movieclip on your stage is only ever going to do one of three things:

1. Expand to twice its width and play();
2. Move 84 pixels to the left.
3. Move 84 pixels to the right.

You should be able to set up a variable, which signifies which movie is active and then attach scripts to each of your movies, telling it what to do, depending on which movie is active. You can use if statements or a switch/case statement... I'll use if... cos I'm lazy and I can't be bothered to look it up :)

You could expand on these if statements and include scripts which will make the clips move nice and smoothly.

This is an example of clip 3's script:


onClipEvent(enterframe){
if (activeClip==1){
this._x +=84;
}
if (activeClip==2){
this._x+=84;
}
if(activeClip==3){
this.gotoAndPlay(2);
}
if(activeClip==4){
this._x-=84;
}


Something like that.

EDIT:

To expand that, if you wanted to make your movies centred at the start of your main movie, you would be moving your movies only 42 pixels to the right or left and you would have to move your active movie 42 pixels too, in addition to making it 2x wider.

Hope that makes sense! :eek: