PDA

View Full Version : [FMX] Really easy question, Don't know the answer!!



cybergold
January 29th, 2003, 10:18 PM
I have a button which i tell to do a .play action. However, it continues to play the same clip if the user touches the button again, i don't want this. How do i make AS that discontinues the script when this action is fulfilled? :smirk:

cybergold
January 29th, 2003, 10:30 PM
:sigh:

Jubba
January 29th, 2003, 10:33 PM
Use variables



on(press){
if(nFlag == true){
//do This....
nFlag = false
}
}


and somewhere in the main timeline put


nFlag = true

cybergold
January 29th, 2003, 10:35 PM
I want it to play an MC, after the MC has been played only once, i want the buttons AS on that MC to cancel? Can you explain please? Thanks for the quick response :bounce:

Jubba
January 29th, 2003, 10:38 PM
whatever you want to do it would be using basically the same idea at what i have. do you have a sample file that you could post that would help me help you?

cybergold
January 29th, 2003, 10:38 PM
Sorry, let me reword that :hangover: I meant... I have a button, i touch it, it plays an MC, the MC has a stop at the end of it. I no longer want this to happen again, how can i make it so that the AS line on that button which affects the MC will not occur? When the button is touched again, it plays the MC all over again C:-) sounds simple enough, (not for me)

Jubba
January 29th, 2003, 10:45 PM
Ok, I understand completely. So do what I told you to do in my first post. Where it says "//do This..."

replace with the play() script....

cybergold
January 29th, 2003, 11:40 PM
The AS looks pretty solid, thanks i am going to try it right now, one more Q, where on the timeline do i place the nFlag?

lostinbeta
January 29th, 2003, 11:42 PM
Usually first frame.


And the AS is solid... It is Jubba. Trust the Jubba.

cybergold
January 29th, 2003, 11:43 PM
That was quick! Thanks! =) lol

lostinbeta
January 29th, 2003, 11:49 PM
No problemo ;)

cybergold
January 29th, 2003, 11:59 PM
Ran into something else, How do i disable the button when the keyframe has been activated. Goal: to touch a button and go to a keyframe, then use the same button to open swf's. Thanks for all the help!

lostinbeta
January 30th, 2003, 12:00 AM
Huh?


Are you planning on running EVERYTHING off one button?


I don't get it.

cybergold
January 30th, 2003, 12:07 AM
Main timeline: frame one(stop action) frame 2 (no stop action) frame 5 (stop action). there are 7 buttons... Whatever button the user touches first, i want the button to activate the next frame (since there is no stop on 2, it will go straight to 5) When the frame is at 5, i want it to no longer allow the user to hit the buttons and make the frame start all over again at 2 anymore, i just want those buttons to load swf's, In other words, i want it to stay on frame 5, and those buttons to load swf's sorry for the confusion :sigh:

lostinbeta
January 30th, 2003, 12:10 AM
Ok... modifying Jubbas code...


on(press){
if(nFlag == true){
//do This....
nFlag = false
} else {
//do This
}



The //do this under the else is where you add your loadMovie code.


And it says that if nFlag is NOT true (which you set it to false the first time) then it should do that.

cybergold
January 30th, 2003, 12:24 AM
what is nFlag?:-\

lostinbeta
January 30th, 2003, 12:27 AM
Just a typical variable.


For all Flash cares you could call it doThisYouPieceOfCrap, just as long as you are checking that variable for it to work.

cybergold
January 30th, 2003, 12:32 AM
Here is what i have, it just doesn't add up, maybe i am forgetting an instance name or something...





on (release) {
_root.play();
}
on (release) {
if (nFlag == true) {
gotoAndPlay(2);
nFlag = false;
} else {
loadMovie("inout.swf", "clip");
}
}

lostinbeta
January 30th, 2003, 12:35 AM
You shouldn't have two on(releases) you can do everything you need to in one.



on (release) {
if (nFlag == true) {
_root.play()
nFlag = false;
} else {
_root.clip.loadMovie("inout.swf")
}
}


Try that.

cybergold
January 30th, 2003, 12:52 AM
It did not work...:smirk:

cybergold
January 30th, 2003, 12:54 AM
The buttons i am using are inside of a movie clip.

lostinbeta
January 30th, 2003, 01:00 AM
Is your "clip" movie clip inside the same movie clip? If so then try getting rid of _root and replacing it with _parent or just getting rid of it altogether.

_root targets the main timeline


_parent targets the timeline before the one the current movie clip is in

cybergold
January 30th, 2003, 01:05 AM
Here is what happens, the first time i hit the button, it does ok, and goes to frame 5, but then the second time i hit it, and want it to open a swf, it goes all the way back to frame 1( desired effect is for the frame to stay at 5 and for the button to open swf's)

I tried the _parent thing, nothing. But thanks for trying...

lostinbeta
January 30th, 2003, 01:11 AM
Target your variable as _parent.nFlag or _root.nFlag instead of just nFlag.

cybergold
January 30th, 2003, 01:20 AM
Do you see my previous AS? look at the first _root.play, what is negating that action? Is that what keeps telling the frame to go up one?

cybergold
January 30th, 2003, 01:25 AM
It worked!!!!! it works perfectly! :bounce: :beam: Thanks for all the help! Calling the variable (nFlag) from _root. is what made everything connect and work. I never would have seen that. Good Stuff! Keep it up!

lostinbeta
January 30th, 2003, 01:26 AM
Yeah, that is it because everytime you release it says to play the _root timeline.


Assuming you have the nFlag variable on Frame 1 of the same timeline your button is in (and also the "clip" is in the same timeline too)... try this..


on (release) {
if (_parent.nFlag == true) {
_parent.play();
_parent.nFlag = false;
} else {
_parent.clip.loadMovie("inout.swf");
}
}

lostinbeta
January 30th, 2003, 01:27 AM
Oh ok... you fixed it.


Congrats :)

cybergold
January 30th, 2003, 02:12 AM
I am using a menu system, how can i make it so that one menu does not stick around while another is open? Can you explain it?

lostinbeta
January 30th, 2003, 02:14 AM
Depends on how your menu system works.

cybergold
January 30th, 2003, 02:18 AM
It is 3 animated buttons in an MC with the first clip empty. It runs on a button which is on the main timeline, that button, when rolled over, has a _root.play to activate the animated menu. when two or more are put together, they overlap, or don't go together too well, how can i fix this?

lostinbeta
January 30th, 2003, 02:24 AM
Have an on(rollOut) on the button and target it to play an out animation.

cybergold
January 30th, 2003, 02:26 AM
what do you mean by out animation?

lostinbeta
January 30th, 2003, 02:33 AM
Sorry, I am very tired, it is 2:30am here.


You say you have it play() on(rollOver) right? And this activates your menu.


Well if when you rollOver another menu it overlaps, then perhaps adding an on(rollOut) to your button can activate an out animation.


So like you have it play() the in animation until it hits a stop action. Then after that stop action comes the out animation to and you target that on rollOut.

So

rollOver - play in
rollOut - play out




Now that I am thinking about it, I am not sure this makes sense.


I really have to get to bed now :(

cybergold
January 30th, 2003, 02:35 AM
get some rest man, that makes no sense, try again tommorrow :crazy:

lostinbeta
January 30th, 2003, 02:37 AM
Goodnight :hangover:

cybergold
January 30th, 2003, 10:46 AM
Alright, back to my question...:bounce:

cybergold
January 30th, 2003, 01:14 PM
anyone have a solution?

lostinbeta
January 30th, 2003, 01:37 PM
Ok, time to see if I am understanding correctly.


Please check the .fla file :)

cybergold
January 30th, 2003, 02:39 PM
on (rollOver) {
_root.closedmenu.menuA.play();
}
//button on main timeline





The MC menu it activates ends at frame 13

cybergold
January 30th, 2003, 02:54 PM
it is because the button on the main timeline is not a movie clip, that is why it does not work

lostinbeta
January 30th, 2003, 04:25 PM
It would be a lot easier to fix according to your situation if you could supply an example .fla.

cybergold
January 31st, 2003, 12:41 PM
Here is the fla you requested, i can't seem to fix it...

cybergold
January 31st, 2003, 12:42 PM
whoops =)

lostinbeta
January 31st, 2003, 01:13 PM
Ohhh... see with the file it is much easier to fix.

Well what you want to do is that when you rollOver one menu you want to close the other menu so it isn't shown anymore.

Since frame 1 of your menu is blank, just gotoAndStop at the other menu when you rollOver a button.

Check the attachment to see what I mean.

cybergold
January 31st, 2003, 01:20 PM
:beam: thanks! greatly appreciated.

lostinbeta
January 31st, 2003, 01:22 PM
No problem ;)