6 Replies - 4117 Views - Last Post: 29 May 2009 - 01:08 PM

#1 Adaptive  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 09

AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Post icon  Posted 16 January 2009 - 08:56 PM

Let me start off by saying hello
I'm new here from the US.

So anyways. I have this little project I'm working on.
I have successfully created the buttons and mouse over movies and everything works great.
But on when the mouse rolls out the button just snaps back to 1. Yes this is how it is supposed to be...
BUT instead of snapping back to frame 1 I would like it to GLIDE or FADE back to frame 1.



The button in the code below is 10 frames with stop frame at 10.
On frame 11 I made the reversal of frames 1 - 10 to fade the button back in to 100% alpha.

for an example:
The button goes from 100% alpha to 0% (frame 1 - 10) on rollover
ON rollout it snaps back to frame 1 with 100% alpha. (this is what is supposed to happen but not what I want).
I want to make the roll out fade from 0% alpha to 100% alpha on roll out.


Neither code does what I am looking for

this.pro.onRollOut = function(){
	gotoAndStop._11 = 100;
}

this.pro.onRollOut = function(){
	gotoAndPlay._11 = 100;
}





I found this thread.
http://www.dreaminco...h...c=15726&hl=
Not exactly what I'm looking for, but I believe the original poster was looking for similar answer that I am seeking.

I hope I have been descriptive enough.
If not I found this website.... (not the one I am working on)
http://www.makeupforever.fr/
If you mouse over the center it does whatever (this is not a problem for me to make)
but when you mouse out it GLIDES/FADES back to frame 1.... this is what i want!!

=)

This post has been edited by Adaptive: 16 January 2009 - 08:58 PM


Is This A Good Question/Topic? 0
  • +

Replies To: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

#2 parker_as3  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 19-January 09

Re: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Posted 19 January 2009 - 12:27 AM

View PostAdaptive, on 16 Jan, 2009 - 07:56 PM, said:

Let me start off by saying hello
I'm new here from the US.

So anyways. I have this little project I'm working on.
I have successfully created the buttons and mouse over movies and everything works great.
But on when the mouse rolls out the button just snaps back to 1. Yes this is how it is supposed to be...
BUT instead of snapping back to frame 1 I would like it to GLIDE or FADE back to frame 1.



The button in the code below is 10 frames with stop frame at 10.
On frame 11 I made the reversal of frames 1 - 10 to fade the button back in to 100% alpha.

for an example:
The button goes from 100% alpha to 0% (frame 1 - 10) on rollover
ON rollout it snaps back to frame 1 with 100% alpha. (this is what is supposed to happen but not what I want).
I want to make the roll out fade from 0% alpha to 100% alpha on roll out.


Neither code does what I am looking for

this.pro.onRollOut = function(){
	gotoAndStop._11 = 100;
}

this.pro.onRollOut = function(){
	gotoAndPlay._11 = 100;
}





I found this thread.
http://www.dreaminco...h...c=15726&hl=
Not exactly what I'm looking for, but I believe the original poster was looking for similar answer that I am seeking.

I hope I have been descriptive enough.
If not I found this website.... (not the one I am working on)
http://www.makeupforever.fr/
If you mouse over the center it does whatever (this is not a problem for me to make)
but when you mouse out it GLIDES/FADES back to frame 1.... this is what i want!!

=)

you should use a enterframe that detects whether or not you have rolled over the object or rolled out using booleans.
like this:
//stops the animation from playing out intially 
rollbox_mc.stop();

// sets truefalse datatype to boolean and by default it is false
var truefalse:Boolean = false;

//if you roll over the object its true
rollbox_mc.onRollOver = function() {
	trufalse = true;
};

// if you roll out of the object its false
rollbox_mc.onRollOut = function() {
	trufalse = false;
};

//checks if its true on every frame and if it is then proceed to the next frame 
//else if it is false then reverse frames
rollbox_mc.onEnterFrame = function() {
	if (trufalse == true) {
		rollbox_mc.nextFrame();
	} else {
		rollbox_mc.prevFrame();
	}
};


there is a alternative(as is usually the case) using hitTest but i thought i would give you an easier to understand solution.
cheers :)

This post has been edited by parker_as3: 19 January 2009 - 12:34 AM

Was This Post Helpful? 0
  • +
  • -

#3 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Posted 19 January 2009 - 06:34 AM

The way I do this in as2 is fairly simple.

First, you create your 'button', which is actually a movieclip. Lets assume that your animation lasts for 5 frames. The first frame should be static, with a stop, and show the default state of your button. The second frame is the same as the first, but with a label of 'rollover'. Frame 6 will contain the finished rollover state, be it a color chage or whatever. Put a stop on this frame, and create a tween between frames 2 and 6. Next copy the contants of frame 6 to frame 7. Give frame 7 a label of 'rollout'. Move to frame 11, and make this a copy of frame 1, with a stop, and create a tween between frames 7 and 11.

The code to control this, to be placed on the same timeline as the 'button' is:
my_button.onRollOver = function() {
	my_button.gotoAndPlay("rollover");
}

my_button.onRollOut = function() {
	my_button.gotoAndPlay("rollout");
}



I've attached an example in case my wall of text isn't too easy to follow!

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#4 Adaptive  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 09

Re: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Posted 21 January 2009 - 10:58 PM

View Postparker_as3, on 18 Jan, 2009 - 11:27 PM, said:

View PostAdaptive, on 16 Jan, 2009 - 07:56 PM, said:

Let me start off by saying hello
I'm new here from the US.

So anyways. I have this little project I'm working on.
I have successfully created the buttons and mouse over movies and everything works great.
But on when the mouse rolls out the button just snaps back to 1. Yes this is how it is supposed to be...
BUT instead of snapping back to frame 1 I would like it to GLIDE or FADE back to frame 1.



The button in the code below is 10 frames with stop frame at 10.
On frame 11 I made the reversal of frames 1 - 10 to fade the button back in to 100% alpha.

for an example:
The button goes from 100% alpha to 0% (frame 1 - 10) on rollover
ON rollout it snaps back to frame 1 with 100% alpha. (this is what is supposed to happen but not what I want).
I want to make the roll out fade from 0% alpha to 100% alpha on roll out.


Neither code does what I am looking for

this.pro.onRollOut = function(){
	gotoAndStop._11 = 100;
}

this.pro.onRollOut = function(){
	gotoAndPlay._11 = 100;
}





I found this thread.
http://www.dreaminco...h...c=15726&hl=
Not exactly what I'm looking for, but I believe the original poster was looking for similar answer that I am seeking.

I hope I have been descriptive enough.
If not I found this website.... (not the one I am working on)
http://www.makeupforever.fr/
If you mouse over the center it does whatever (this is not a problem for me to make)
but when you mouse out it GLIDES/FADES back to frame 1.... this is what i want!!

=)

you should use a enterframe that detects whether or not you have rolled over the object or rolled out using booleans.
like this:
//stops the animation from playing out intially 
rollbox_mc.stop();

// sets truefalse datatype to boolean and by default it is false
var truefalse:Boolean = false;

//if you roll over the object its true
rollbox_mc.onRollOver = function() {
	trufalse = true;
};

// if you roll out of the object its false
rollbox_mc.onRollOut = function() {
	trufalse = false;
};

//checks if its true on every frame and if it is then proceed to the next frame 
//else if it is false then reverse frames
rollbox_mc.onEnterFrame = function() {
	if (trufalse == true) {
		rollbox_mc.nextFrame();
	} else {
		rollbox_mc.prevFrame();
	}
};


there is a alternative(as is usually the case) using hitTest but i thought i would give you an easier to understand solution.
cheers :)




Sweet, do you have any samples using the method you described, I have no clue with booleans so I will have to do some research before i attempt it. With this would I have to make a reversal of the rollOVER or would the booleans reverse the over automatically or something? Got an email address or aim?


View Postthehat, on 19 Jan, 2009 - 05:34 AM, said:

The way I do this in as2 is fairly simple.

First, you create your 'button', which is actually a movieclip. Lets assume that your animation lasts for 5 frames. The first frame should be static, with a stop, and show the default state of your button. The second frame is the same as the first, but with a label of 'rollover'. Frame 6 will contain the finished rollover state, be it a color chage or whatever. Put a stop on this frame, and create a tween between frames 2 and 6. Next copy the contants of frame 6 to frame 7. Give frame 7 a label of 'rollout'. Move to frame 11, and make this a copy of frame 1, with a stop, and create a tween between frames 7 and 11.

The code to control this, to be placed on the same timeline as the 'button' is:
my_button.onRollOver = function() {
	my_button.gotoAndPlay("rollover");
}

my_button.onRollOut = function() {
	my_button.gotoAndPlay("rollout");
}



I've attached an example in case my wall of text isn't too easy to follow!





Yeah this is the same though process I had. I was not able to get it to work my way because I am not too good at coding, so when I get home I'll certainly give your method a go. This should be very easy for me because it seems like we are on the same brain frequency here. But will the code/method work... hopefully; that will be the test! =)

Thanks soo much for the reply :^:
Was This Post Helpful? 0
  • +
  • -

#5 Xeophex  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-February 09

Re: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Posted 05 February 2009 - 06:18 PM

Did you manage to get it working Adaptive? Which method? I'm after the same solution myself.
Was This Post Helpful? 0
  • +
  • -

#6 Adaptive  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 09

Re: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Posted 06 February 2009 - 10:37 AM

View PostXeophex, on 5 Feb, 2009 - 05:18 PM, said:

Did you manage to get it working Adaptive? Which method? I'm after the same solution myself.



Didn't try yet, got more work thrown on my lap. grrr that always happens
hope to do it this week though


hehe
Was This Post Helpful? 0
  • +
  • -

#7 fishka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-May 09

Re: AS2 rollOut - Do not want to snap back to 1 but instead glide back to

Posted 29 May 2009 - 01:08 PM

TheHat,

I'm a new flash user and I had the same issue as the original post. I have been searching on all sorts of forums for the past few days and
when I found your suggestion I tried it.

Here is what I have, Im not sure why its not working- its messing up my other actions (the actions, such as stops, in my other movie clips that were already in place).... Any ideas? maybe something with the as2 ...though I thought my actionstript was as2 as well..


Thank you for your help!

Attached File(s)


This post has been edited by fishka: 29 May 2009 - 01:10 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1