PDA

View Full Version : Cool Function Idea



tomyknoker
10-09-2006, 05:08 AM
Hi All,

I have a mc which onRollOver slides to the right to reveal a text box and scroller. I also have on the mc that onRollOut to slide to the left, closing the mc which hides the text box and scroller underneath a box. The problem I am having is that when the user rolls onto the scroller which is in the mc, Flash sees that as activating the onRollOut action, which means the mc closes. I am thinking that I would need a function of some kind that only closes the mc if the mouse is outside of the _x and _y values of the mc... Anyone agree and anyone have any ideas on how to do this?

Thanks all in advance!
Tom

BLiZZaRD
10-09-2006, 08:41 AM
I agree, you will need AS to run the rollOver and rollOut based on mouse position. I am not sure how to do this, but will run a search and let you know if I come up with anything.

tomyknoker
10-09-2006, 08:44 AM
I agree, you will need AS to run the rollOver and rollOut based on mouse position. I am not sure how to do this, but will run a search and let you know if I come up with anything.Hi Blizzard,

Thanks! Someone suggested I look at this, http://www.senocular.com/flash/tutorials/buttoncapturing/ It actually seems perfect but not sure how to apply it exactly... :confused: I could attach the file if that would help??

BLiZZaRD
10-09-2006, 08:59 AM
okay I bookmarked it, just got a comotion at work to handle, I will look at it after this cools down and see what we can do.

tomyknoker
10-09-2006, 09:02 AM
okay I bookmarked it, just got a comotion at work to handle, I will look at it after this cools down and see what we can do.Blizzard thanks again so much! Hope things don't get too crazy at work! Here's the file if you need to look at it... It's in 8 but I can save to MX if needed... http://www.curiousclothing.com/files.zip

BLiZZaRD
10-09-2006, 09:03 AM
Yeah I would need it in 7 to view it. But you can wait on that, I will see what I can get from the tut first.

Back in a few... stupid drunks...

BLiZZaRD
10-09-2006, 11:23 AM
Okay I had a look-see. Seems a bit complicated for what you want to do.

I have always tried to be as simple as possible, and this is another case where it seems another option should be easier.

To start you have 2 MCs, one that slides to the right on mouseOver, and a second under that one which contains a text box etc.

Lets combine them into one MC.

SO you have moving_MC and text_MC. Okie dokie. Open moving_MC in edit mode.

I am not sure your layout here so you will have to adjust as needed

moving_MC has 3 frames. Frame 1 is the MC as it sits on stage, with a stop(); code on it.

go to frame 2, this is where the moving_MC moves to the right. Add a new layer with a blank keyframe on frame 2. Make sure this layer is BELOW the other.

Now from your library, drag text_MC to the stage and position it where needed.

(note if you have this moving right as a tween, it will be a child of this current layer selection, you should add your text_MC to this child)

now for the code.

you obviously have a: stop(); on frame one. On your scripts layer of frame 2 you should have a stop(); as well. Also frame 3 (this should be your "return" or moving left animations) should have a stop(); AND inside on the tweening frames the very last one should have this:



_root.moving_MC.gotoAndStop(1);


now on the top level of this entire MC add this to your Actions Panel:



on(rollOver){
this.moving_MC.gotoAndPlay(2);
}

on(rollOut){
this.moving_MC.gotoAndPlay(3);
}


You may need to play around with it a bit to get it perfect, but the idea is that when you mouseOver the moving_MC it will go to the tween frame and play, in essence showing the item moving to the right, and revealing the text_MC under it. When you mouseOut then you will go to frame 3 which shows the moving left animations and when it reaches it's end it will jump back to frame 1 and stop. All is back to where it started.

Obviously you will have to play around with the exact labeling and parent/child calls in the codes, but I think you get the idea.

tomyknoker
10-09-2006, 12:43 PM
Okay I had a look-see. Seems a bit complicated for what you want to do.

I have always tried to be as simple as possible, and this is another case where it seems another option should be easier.

To start you have 2 MCs, one that slides to the right on mouseOver, and a second under that one which contains a text box etc.

Lets combine them into one MC.

SO you have moving_MC and text_MC. Okie dokie. Open moving_MC in edit mode.

I am not sure your layout here so you will have to adjust as needed

moving_MC has 3 frames. Frame 1 is the MC as it sits on stage, with a stop(); code on it.

go to frame 2, this is where the moving_MC moves to the right. Add a new layer with a blank keyframe on frame 2. Make sure this layer is BELOW the other.

Now from your library, drag text_MC to the stage and position it where needed.

(note if you have this moving right as a tween, it will be a child of this current layer selection, you should add your text_MC to this child)

now for the code.

you obviously have a: stop(); on frame one. On your scripts layer of frame 2 you should have a stop(); as well. Also frame 3 (this should be your "return" or moving left animations) should have a stop(); AND inside on the tweening frames the very last one should have this:



_root.moving_MC.gotoAndStop(1);


now on the top level of this entire MC add this to your Actions Panel:



on(rollOver){
this.moving_MC.gotoAndPlay(2);
}

on(rollOut){
this.moving_MC.gotoAndPlay(3);
}


You may need to play around with it a bit to get it perfect, but the idea is that when you mouseOver the moving_MC it will go to the tween frame and play, in essence showing the item moving to the right, and revealing the text_MC under it. When you mouseOut then you will go to frame 3 which shows the moving left animations and when it reaches it's end it will jump back to frame 1 and stop. All is back to where it started.

Obviously you will have to play around with the exact labeling and parent/child calls in the codes, but I think you get the idea.Hey Blizzard,

Thanks for the help... I gave it a try but because I'm using MC_Tween it's a little complicated to do that... Can you take a look at the linked example and give me some advice on how to tackle it! http://www.curiousclothing.com/files_mx.zip :confused: Much appreciated!

BLiZZaRD
10-10-2006, 08:57 AM
Sorry buddy I didn't get this til I was at work. I will have a go at it tomorrow when I get home.