-
I am working with an mc that is the button control for the main scene. I am attempting to create an else if statement for a Button within the mc that says for eg. If on frame "topview1" then go to frame "topview3".
Here is what my code looks like for the button in the mc that controls the main scene:
on (release) {
_root.gotoAndPlay("topview2");
}
Any Help?
-
Well, Im new to actionscripting and I don't know if this is totally correct, but you could give it a try...and if it doesn't work, maybe it will point you in the right direction, good luck,
William
----------------------------------------------------------
on (release) {
if (_root._currentframe = "topview1") {
_root.gotoAndPlay("topview3")
}
}
----------------------------------------------------------
-
reply
well the code you suggested sounds about right. I tried it out and no luck. Im gonna keep playing with it, hopefully Ill crack it. ;?
-
I have recieved some info from someone else who gave me this:
on (release) {
if (_currentframe == "pack3") {
;
}
_root.gotoAndPlay("blackdiamond");
}
Unfortunatly it doesnt work either. Im hoping that someone who is viewing this who has a better idea as to what seems to be wrong.
Just so that there is more information about my question. I am needing to control the frame play on scene1 I am only using one scene. I have a mc that is the controler for scene1. I need to have a string of code that checks the frame in scene1 and then calls the function to go to a different frame to play if it is already on a specific frame.......
HELP!!!!!!!!!!
-
Hope this helps
Well this is the code I use on my buttons,
----------------------------------------------------
on (rollOver) {
this.gotoAndPlay ("hover");
if (_root.about_slider._currentframe != 20) {
_root.about_slider.gotoAndPlay(2)
}
}
---------------------------------------------------------
See the difference in what you want to do and what I do is that I'm telling it that if it's NOT on a certain frame. You want it to say if ON a certain frame...
Basically it goes like this: if my about_slider is NOT on frame 20 then gotoAndPlay frame 2.
So all you need to do is figure out how to say, if my "whatever" is on frame "SomeName", then gotoAndplay "this framename"
-
If you look in by code you will see "!=" after currentframe.
In my book that is described as a "check for inequality" operator. And this "==" is a check for equality operator. So considering that you want to do the opposite of what I do then you would use the "==" operator, so the info you recieved on using that operator has to be right. So you should use that. Maybe there is some other thing wrong instead of your code, ie did not name an instance, or wrong frame #, something like that. I found that when I have problems like that it's usually something simple like that.
Good luck, William
-
ok here it is
on (release) {
if (_root._currentframe == "topview1") {
_root.gotoAndPlay("topview3")
}
}
got ride of the semicolon and rearanged the curly brackets.
I tried it and it works perfect. If you can't get it let me know and I will drop the .fla file online so you can look at it. But try to figure it out on your own, that the only way you will get it.
Good luck, william
-
Cool thanks william, I will give it a shot and see if it works for me. Ill keep you posted.
-
This is wacked...I tried it again and it doesnt work. Here is all the code that is inside my button that is within the mc.
on (release) {
_root.gotoAndPlay("blackdiamondspapack");
}
on (release) {
if (_root._currentframe == "black-spastop") {
_root.gotoAndPlay("blackview")
}
}
For whatever reason it is not going to blackview if it is stoped on black-spastop. Maybe its FlashMX?
-
I made a new movie and yes the code does work on its own. But I found that if you have a code that calls a fuction if it is on a different frame to play another frame it doesnt work. Here is the code that I am working with.
on (release) {
if (_currentframe == "topview-blackstop") {
}
_root.gotoAndPlay("finishing");
}
on (release) {
if (_currentframe == "blackdiamondspapack") {
}
_root.gotoAndPlay("blackdiamondspapack2");
}
Any ideas?
PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!
-
I think you have to move the closing curly bracket to the very end of the script like
-------------------------------------------------------
on (release) {
if (_currentframe == "topview-blackstop") {
_root.gotoAndPlay("finishing");
}
}
on (release) {
if (_currentframe == "blackdiamondspapack") {
_root.gotoAndPlay("blackdiamondspapack2");
}
}
--------------------------------------------------------
Is there anyway you can post the .fla so I can look at it and try to help you out?
-
I tried posting the fla. on my website server and it wouldnt allow it. if you have icq I can send it that way.
-
-
here I managed to get geocities set up...try this:
http://www.geocities.com/darbonian/yes.fla
-
possible solution > 123webwizard
As far as I've understood your problem, I think it can be resolved with a very simple approach.
------------------------------------------------------
Step1:
------------------------------------------------------
Make a movie clip and give it an instance name > "button_mc"
------------------------------------------------------
Step2:
------------------------------------------------------
Put the following actions scriplet into a seperate frame/-layer in your _root.
// button routine
button_mc.onPress = function() {
var cframe = _root._currentframe;
if (cframe == 20) {
trace("Current frame is: "+cframe);
// gotoAndPlay(30);
// or any frame label to jump to
} else if (cframe == 10) { //else if's to ur taste
trace("Current frame is: "+cframe);
} else {
trace("Any frame!");
}
};
------------------------------------------------------
Step3:
------------------------------------------------------
Extend your movie to any number of frames. Make/Change the frame numbers in the above scriplet to suit your movie.
adios B~)
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
|