HELP With The For Loop And GotoAndStop();
Hi! I've been trying to do this and I haven't been able to figure it out yet. What I'm trying to do is the following: 1) I have a set of movieclips that are menus that have an active and inactive state (frame labels) in different frames each. Let's say I have 3 and that the mc are called m1, m2 and m3. 2) I want to be able to inactivate all the other menus when one is clicked using a loop function. 3) So the syntax in the m1 movieclip "would" be like this:
on(release){ for(i=1; i<4; ++i){ menu="_parent.m"+i; menu.gotoAndStop("inactive"); _parent.m3.gotoAndStop("active"); } } this is how close I got (trying to inactive all of them and then activate the one clicked. ( I know that _parent.m1.gotoAndStop("active"); and the same for m2 and m3 works but I want to automate it...what if I had 30 menus?); Please some Feedback!!!
PS: I was reading the Coock reference and maybe I have to try a timeline based solution but it seems that you don't have the same type of control do you? (like repeating a cycle 3 times...well I guess you could use a variable for that )
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-16-2003, 03:41 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
GotoAndStop In A Loop Impossible?
The idea of this code is simply, to get values from a predefined mc structure on different frames.
onClipEvent(load){
var i=1;
x=new Array();
while(i<=6){
cube.gotoAndStop(i);
x[i]=cube._x;
trace(x[i]);
i++;
}
}
...but it only traces the first value, and totally ignores the gotoAndStop commands. Does anybody have any thoughts on this? I could play the mc normally and collect the values, but then the setup-time would be too long if the structure reaches a large amount of frames.
Brutally Simple GotoAndStop/Loop Fails?
Here is a very simple script which checks that the swf is running on its valid domain, and loop continuously if so, and if not puts up a message and stops there. Instead when the domain check fails (as expected) it stops at an inexplicable frame. I've tried different frame labels and even frame numbers, even extra frames in between to no avail. Please help me 'cuz I'm wiggin' out!
//FRAME 1
if( isRegisteredDomain(domainList, _level0._url) == 0){
_root.gotoAndStop("UNAUTHORIZED");
//this.unloadMovie();
}
//FRAME 2: Labeled "Loop"
//FRAME 3-30 straight animation and no AS
//FRAME 31
_root.gotoAndPlay("Loop");
//FRAME 32 Labeled "UNAUTHORIZED"
stop();
Problem With For...in Loop Called From MC, And _root Not Hearing A GotoAndStop...
[I've posted this on Actionscript.org as well, apologies to those on both forums]
I have a series of MCs that open up from _root. _root is still visible since the MC's only take up about 2/3 of the screen. They also tell the main timeline (_root) to go to a "disabled" frame that has no button objects in order to not have the mouse react to what's behind the currently opened MCs. Because of this I have a "main" button that is supposed to close all open MCs and move _root's playback head back to a specific frame once the MCs are closed.
Each of the MCs that open add themselves to an array stored at root with gSceneList.push(this);
Subsequently, clicking _root's "main" button calls a global function:
Code:
_global.clearSceneList = function (){
for (var index in gSceneList){
gSceneList[index].gotoAndPlay("fade");
gSceneList[index].pop();
}
}
Every MC that pushed its reference into the array with gSceneList.push(this) goes to their respective "fade" frame but the "main" button that calls this also includes a _root.gotoAndStop("mainFrame");
For some reason, the _root timeline won't go to the "mainFrame" frame label. It's as if the for...in loop is not releasing to the main timeline, like it never broadcasts that it's finished.
If I click the "main" button a second time, it behaves properly and then returns to the "mainFrame" label.
Any ideas as to why the root timeline doesn't go to the necessary frame when told to do so after this for...in loop?
Any help or insight is greatly appreciated.
-PBME
Gotoandstop
Hi I have a big problem in Flash5...
I'm using the GotoandStop funktion, and I think I have found a bug!
This is my code that doesn't work...
gotoAndPlay (variable);
the variable is a dynamic number... this wont work... why is that
Gotoandstop: Help Help Help
I need help..please
MovieA:
I have a button w/ the following script
on (release) {
loadMovieNum ("movN.swf", 1);
_level1.gotoAndStop("NormanE");
}
Movie "movN.swf":
1st frame is empty with script "stop"
2~6 frame: is label "JohnL" (picture)
7~11 frame is label "NormanE" (picture)
Objective:
When I click on the button, I want it to load up movieN and stop at the NormanE frame.
Problem:
First click, it will load up movN and stay at the first frame. "I know it's the [stop] that cause the problem"
If you click on it again, it will go to NormanE frame, but then NormanE frame will disappear and conintue to play back to the first empty frame.
HELP:
I need to know how I can stop at the NormanE frame and not let it continue to play back to that first stop frame. Is it because of the _level1 script? PLease help me..
PS. I tried to place stop at every place..and that didn't seem to help.
Gotoandstop?
When using the gotoandstop() command, how can I use the value in a combobox's data field as the frame number to goto?
I'm a newbie so please keep that in mind in your reply.
Thanks for any help.
GoToAndStop
Hi All,
I'm sort of new to Flash and Flash MX so I sometime have problems with the simplest things.....
Ok, my problem is this, I have a button object located inside a movieclip. When this button is pressed, it suppose to go to a Frame Label located in the main scene (eg. Scene 1). But everytime I add the action gotoandplay or gotoandstop to the button, it just go back to the beginning of the movieclip rather then going to the frame label in scene 1.
I've tried adding things like "_root.FrameName", "_parent.Framename" and "_root.FrameName" but none of these works. I know it's just something simple, can anyone help me please?
Thank you in advance!!!!
Ken
GotoAndStop ?
Hi,
How would I use a dynamic text box to go to a specific frame?
This code won't work:
on (release) {
gotoAndStop(_root.bookmark.text);
}
I tried assigning it to a variable(ie. var bkmrk = bookmark.text) and putting it in quotes.... but no luck.
Gotoandstop
i have a clip inside another clip that has a button that send the main timeline to the frame 32, but it doesn´t do it.
This is the code:
on (release) {
this._parent._parent.gotoAndStop(32);
}
but if i change the frame to 52, it works perfect...
why this is happening¿?
someone knows
GotoAndStop Help
I have a movie with several different scenes in it. At the end of one scene, I want it to automatically go back to the previous scene. How do I do that? I've tried pasting a gotoAndStop ("main, 1"); action in the last frame but it doesn't work. thanks.
-tucker-
GotoAndStop
i put the following script on a clip
on (rollOver) {
gotoAndPlay(85);
}
but it doesnt work.
what's wrong?
Gotoandstop Help...
well, I just made one scene with 26 frames in it...
and it still didnt work. Here is what I have:
yes, 25 and 26 are keyframes
I have one picture that stays at the same spot for all 26 frames. I want it to jump to frame 25 when clicked on and then stops there. Then there is an image above that picture that moves along the screen that I want to jump to frame 26 on mouseover and stops there.
Also, The movie ends at frame 24 and then loops back to 1..
The first picture actionscript is the following:
on (release) {
//Movieclip GotoAndStop Behavior
this.gotoAndStop("25");
//End Behavior
}
The second picture actionscript is this:
on (rollOver) {
//Movieclip GotoAndStop Behavior
this.gotoAndStop("26");
//End Behavior
}
What is wrong here? I dont understand
GotoAndStop(); ?
Hi everyone, im making an inventory in my game. My problem is that I want to have the inventory in the middle of the screen. I have the inventory an mc with the first frame empty and the second frame of the mc has all the item slots and stuff in it. I was thinking just put that in the middle of the screen with a stop(); action on frame 1 of the mc and have this script to open inventorty.
if (Key.isDown(Key.ENTER)) {
_root.inventory.gotoAndStop(2);
}
For some reason its not working I dont know why my other problem is I actually want it on key press "i" but I dont know the code for it so if anyone can give me that. . .
thanks
-Joey_
Help With GotoAndStop...
could any know how to do this pls help..
function displayNumber(){
var ramdomNumber:Number = Math.floor(Math.random() * 10);
trace(ramdomNumber);
gotoAndStop(ramdomNumber);<< my problem
updateAfterEvent();
};
var numInterval = setInterval(displayNumber, 1000);
gotoAndStop value should be evaluated as frame name not as frame number. coz i want to make a random display of frames.
Help With GotoAndStop...
could any know how to do this pls help..
function displayNumber(){
var ramdomNumber:Number = Math.floor(Math.random() * 10);
trace(ramdomNumber);
gotoAndStop(ramdomNumber);<< my problem
updateAfterEvent();
};
var numInterval = setInterval(displayNumber, 1000);
gotoAndStop value should be evaluated as frame name not as frame number. coz i want to make a random display of frames.
Gotoandstop
this is my problem
When a button is pressed I want it too go to frame 2 and stop.
this is the script I'm putting on the button (not on the frame itself):
on(release){
goto and stop ();
}
what is the problem with this script?
(i know it donst have a bit too tell it where to go, but I have no idea where too put it!)
GotoAndStop
Ok this should be an easy one...
If I use the following AS, my Bgrounds movie goes to and stops at frame 5 on the timeline. code: BGrounds.gotoAndStop(5);
So why is it if assign 5 to myValue then the gotoAndStop() doesn't work. For example: code: myValue =5;
Bgrounds.gotoAndStop(myValue);
Am I missing something?
[F8] GotoAndStop?
how do i use the gotoAndStop command on a button so that when it is selected information appears beside it and also another button that when selected makes more info appear with another button etc etc so as the buttons are selected in sequence the page gets covered with this info.
has this got anything to do with frameLabels and the timeline?
Gotoandstop Help --- Please
hi peeps,
I'm having trouble with something that should be simple ( probably just me )
in my scene I have 10 frames , each frame is stopped and runs a separate movie within each frame. the movie on frame 1 is called "movie1" and has 40 frames within it. On frame 10 on the main timeline ( root ) I have a button called "gohome" (in the instance name) that I would like ( once clicked ) to take the user to frame 20 within "movie1" movie on frame 1 ( I have labelled frame 20 "new" ).
I thought the script should look something like this
gohome.onRelease = function() {
_root.movie1.gotoAndPlay("new");
}
but It won't do anything,
If i do
gohome.onRelease = function() {
_root.gotoAndStop("start"); <--- btw "start" is frame 1's label
}
then it works, in as much as it plays "movie1" but i am trying to start the movie half way through on the users second time round.
Please help it's driving me nuts.
Thanks
ps , posted in flash 8 forum aswell but realised i am using flash mx pro 2004 - so re posted here
PROBLEM SORTED ----------- THANKS
.
GotoAndStop
I am using Flash 3 and am attempting to put a gotoAndStop command in my Action Script file. I want to move the playhead to the appropriate frame when a random number is chosen. The confounded Flash Help is not clear as to what verbage should go in the parentheses after gotoAndStop.
Here is a cut out of my script. The 3 within the gotoAndStop is the frame to which I want the playhead to stop.
{
nChance = Math.ceil(Math.random() * 16);
//if (nChance = 1 || 2)
if(nChance == 1 || nChance == 2)
{
EndingString= " Move Right";
x=x+10;
gotoAndStop(3:Object):void
}
If anyone can help, I'll be forever grateful as the fate of the free world relies on my figuring this out.
[F8] Gotoandstop?
hi,
ive got a button, when i click that button, it goes to a frame called "play" and plays a random animation, but how do i write it so it goes to that frame, plays the animation, but then goes to another frame (i.e play2) after its done?
Thanks for any help
GotoAndStop?
Forgive me I'm new to this and I bet someone can answer this in 2seconds flat...
But i've got a number of frames with different content on them.
As the user clicks a button it should take them to the respective frame
(I'm doing it through the "gotoAndstop" function)
At the moment when I go to test it the file runs through all of them which is obviously not what I want. How do I resolve this
A lil help?
Thanks in advance
noob
Gotoandstop Not Going To :P
Hey, I have an actions layer in my timeline to which I have applied the following code:
Quote:
infobtn.onrelease = function() {
gotoAndStop(2);
}
I have a Stop; action in my frame 1.
My problem is that when the button is clicked, it won't go to frame 2.
Where am I going wrong?
GotoAndStop (var)
I'm pulling some numbers from a text file and I can trace the number, I can send it to a text field, i just cant use it as a variable to gotoAndStop to a frame.
Example:
text file has:
Code:
&frame=50
I've loaded the file in flash and declared:
Code:
frameVAR=this.frame
And as I said, from this point I can trace it, it comes up 50... I can send it to atext field and it will say 50. But trying to use it to declare a frame number, just donest work via:
Code:
gotoAndStop(frameVAR);
Any ideas?
GotoAndStop....
Hi guys,
i'm trying to teach the btn in my menu to move to a certain frame on mouse release.
Code:
on (rollOver) {
this.over = true;
moveTheButts();
}
on (rollOut) {
this.over = false;
moveTheButts();
}
on (release) {
gotoAndStop("Scene 1", "chi");
}
btn doesn't work: the frame I declare doesn't appear.
the movie use AS 1.0 cos I've started from a source file with that code version. But, for the littel I know of AS, the inscuction for gotoAndStop are in AS 2.0...
is the prod due to this? how to solve it?
thanks in advance...HELP!
Gotoandstop Help
Okay so I am really new to flash. All I want to do is link a button to a different frame. More detailed, I want to link the button "Documentation" to a different frame, which is labelled "Docs" and stop there. I have tried all of the codes below but it will not link.
(The codes below are in the Actions for the Documentation button, not the whole frame)
Documentation.onRelease = function (){
gotoAndStop("Docs");
};
Documentation.on(release) {
_root.gotoAndStop(Docs);
}
_root.Documentation.gotoAndStop("Docs");
I have also been getting the following output error:
**Warning** The linkage identifier 'Docs' was already assigned to the symbol 'Documentation', and cannot be assigned to the symbol 'Documentation', since linkage identifiers must be unique.
Well if anyone could help me out that would be great!
Help On GotoAndStop
I have "main.swf" file. The first frame of it has simple actionscript:
Code:
stop ();
if (language == "en") this.gotoAndStop("en"); //English language
if (language == "de") this.gotoAndStop("de"); //German language
Flash get variable "language" from the javascrit function.
I know that the "language" variable is correct every time I call flash, because I output the variable "language" in the dynamic text field.
The problem is that sometimes (not every time), those 2 lines with "gotoAndStop" does not work, and the movie "main.swf" stops on 1 frame.
I hope that someone knows how to fix this bug, because I cannot move forward.
GotoAndStop(this) = Is It Possible?
Hi, Im putting together a little memory card game but I´ve ran into a little problem. Ok it should be simple, ok here is the situation: I have a script that works perfectly for the game it self but the only problem I have is that I want to able to stop on a frame in the cards MC and show a picture.
Code:
trace(this):// Gives in the output: _level0.card7.inbut
this._parent.gotoAndStop(this);
If a card is pressed it gives out the card´s number and some other stuff. So my idea was that I could just make the cards frames with f.e. ("_level0.card7.inbut") as a label for all the cards not just 7. So I thought I only needed to put in gotoAndStop(this)... But that dosn´t work so the question is:
Is there some way to convert this into a string or something, so it can be used in the gotoAndStop(this) function...?
Can anyone help me?
GotoAndStop In As3?
Hello,
I have an animation in a movie clip which are stored inside a movie clip on 3 frames. I am trying to get the ball rolling as it is moved by the arrow keys, but it only goes to the first frame of that animation and stops. Please take a look at my attached file. Thank you very much in advance.
my code looks like this:
ActionScript Code:
var mRight:Boolean;
var mLeft:Boolean;
stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP,KeyReleased);
stage.addEventListener(Event.ENTER_FRAME,enterFRAME);
function KeyPressed(event:KeyboardEvent):void {
if (event.keyCode == Keyboard.LEFT) {
mLeft = true;
mRight = false;
}
if (event.keyCode == Keyboard.RIGHT) {
mRight = true;
mLeft = false;
}
}
function KeyReleased(event:KeyboardEvent):void {
if (event.keyCode == Keyboard.LEFT) {
mLeft = false;
}
if (event.keyCode == Keyboard.RIGHT) {
mRight = false;
}
}
function enterFRAME(event:Event):void {
if (mLeft) {
char.x -= 3;
char.gotoAndStop("left");
}
if (mRight) {
char.x += 3;
char.gotoAndStop("right");
}
if (!mRight && !mLeft) {
char.gotoAndStop("still");
}
}
GotoAndStop(what?);
hi everyone,
i am new here. and i have a question which might be of the sort that i think seems easy, and probably is, but might not be. so here is a shot at it.
in my hypothetical movie clip: when i click on one of the menu items (button_btn), i want it to gotoAndStop(); to a frame ("desired frame"), on a specific frame ("frame name") on my main timeline.
this is all sort of vague, i know, but i can give more detailed info if need be.
so it's like this so far...
this.button_btn.onPress = function(){
with(_root.frames["frame name"]){
pages.gotoAndStop("desired frame");
}
}
this isn't working for me. i'm using AS2 in Flash CS3. any help would be really appreciated.
IS
GotoAndStop() ?
Hey guys, I dont know what is going on with my code but it doesnt seem to work well.
Here's my code:
ActionScript Code:
var card:MovieClip;
var cardX:Number;
var cardY:Number;
var container:MovieClip;
container = new MovieClip();
cardX = 75;
cardY= 50;
card = new mcCard();
container.addChild(card);
card.visible = true;
card.x = cardX;
card.y = cardY;
card.gotoAndStop("Ace");
I have created a MovieClip called mcCard, and there are 2 layers. One layer with 10 blank frames with the name "Ace". Another layer with 10 frame with a picture of a card in it.
I thought that my code was gonna display the card on the screen but when I run it , it doesnt seem to work... Can you guys please help me?
Thanks alot,
Dieuz
GotoAndStop
Ok I kind of forgot how to do actionscript and am trying to get back in to it.
so I made a movie clip or movements and what not and put it on scene1 frame 1. and when the movie clip end I want it to go to scene1 frame2.
I tried a few things I have _root.gotoAndPlay(2); right now it says
1120: Access of undefined property _root.
idk
Thanks
GotoAndStop
Is there anyway of stopping a movie clip timeline from a button in the main timeline other than targetting a frame number or label, with gotoAndStop? I want to stop a mc animation as soon as I click the button.
GotoAndStop
Hi, I'm new to Flash and am trying to load a movie from a button but go to a particular frame. I have a .swf file called InvitationEastern that has fireworks playing when it first opens. Then buttons appear to take you to other pages. From any of those pages I want to go back to InvitationEastern but not have the fireworks play. I want to be back at the buttons so I can go to a different page. It seems like it should be easy enough but of course it doesn't work. It starts from the beginnigng. I tried the script below both with and without "root" but it always starts from the first frame.
on (release) {loadMovieNum("InvitationEastern.swf", 2);
root.gotoAndStop(52);
}
Thanks for any help you can offer.
GotoAndStop HELP
Hi
I have a continuous timeline with intermitent stop();s.
I want to set up a Next/Previous Keypress using the arrow keys.
my invis button is called - start_btn
On the Right arrow I want the playhead to just play next frame.
On the Left arrow I want the playhead to GoBack to the Previous stop(); action.
Can this be achieved instead of targeting Frame Labels or Frame Numbers???
If I'm going the wrong way about this please let me know.
It's a slide show, ala powerpoint so it has page slides and text reveals.
Thanks
GotoAndStop Help
I'm trying to make a website in flash.
I've tried linking the 'main' to the 'about' though i cant seem to get it to work.
I have uploaded the fla here:
http://www.yousendit.com/transfer.php?action=download&ufid=bVlDT213UzhsamVGa1E9PQ
Also if you have a little more time could you please tell me how to get the writing to stay and spin with the record instead of appearing at the end of the tweening
Edited: 01/24/2009 at 09:48:30 PM by Squidg
GotoAndStop Help
Good afternoon people. I'm teaching myself flash and an having difficulty in getting the gotoAndStop feature working correctly and I'm asking for your help in understanding it. I have a site that has flash at the top that plays it's frames in the main index.html. On subsequent pages which are selectable from the main flash, I'd like to open the subsequent page and gotoandstop ad a particular frame. What happens now is the whole animation plays in it's entirety on the subsequent pages. Basically the flash is a description of areas on the site.
The flash displays pictures and text for say sectionA sectionB & sectionC with a replay button at the end. I have corresponding buttons for those sections in the flash that are selectable. When I select sectionA, the page for sectionA loads fine but the whole animation plays again. What I'd like is for the sectionA page to load and only display the frame that corresponds to sectionA in the flash. Here is where I think the relevant instructions go, but for the life of me I can't get it.
Any assistance would be greatly appreciated and thanks.
Attach Code
The flash code:
onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
percent = int(loaded/total*100);
text = percent+"%";
gotoAndStop(percent);
if (loaded == total) {
_root.gotoAndPlay(2);
}
The sectionA page that references the flash:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="686" height="253">
<param name="movie" value="flash/Header.swf?button=1>
<param name="quality" value="high">
<param name="menu" value="false">
<param name="wmode" value="transparent">
<!--[if !IE]> <-->
<object data="flash/Header.swf?button=1"
width="686" height="253" type="application/x-shockwave-flash">
<param name="quality" value="high">
<param name="menu" value="false">
<param name="wmode" value="transparent">
<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
FAIL (the browser should render some flash content, not this).
</object>
<!--> <![endif]-->
</object>
GotoAndStop
i am creating 3 movieclips with actionscript and successfuly giving instance names to them. however, when i try to use the gotoAndStop command and make the other instances go back a few frames i get the following error: 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObject.
Attach Code
private function createModels(event:Event):void
{
if(_mainFrame == 3 && _removeModels == false)
{
_mBX = 473;
_mBY = 1038;
for(var j:Number = 1; j <4 ; j++)
{
mB = new modelButtons();
mB.name = "mB_"+j;
addChild(mB);
mB.x = _mBX;
mB.y = _mBY;
mB.gotoAndStop(models[j]);
mB._targetPiece = leftFrame_mc;
mB.addEventListener(MouseEvent.MOUSE_UP, navigateModels);
_mBX += 139.5;
}
}
}
private function navigateModels(event:MouseEvent):void
{
var mb1:DisplayObject = this.getChildByName("mB_1");
var mb2:DisplayObject = this.getChildByName("mB_2");
var mb3:DisplayObject = this.getChildByName("mB_3");
if(event.currentTarget == mb1)
{
mb2.gotoAndStop(4);
// function works fine if i just use a trace command
}
}
GotoAndStop
Using this code:
tip.addEventListener(MouseEvent.CLICK,gotoTip);
function gotoTip(e:MouseEvent){
gotoAndStop(1);
}
What I am missing for it to stop at Frame 1?
GotoAndStop(value)
ok here's the problem I am creating multible objects from an array which holds values like this;
PHP Code:
object_array[0] = [["type1",xpos,ypos],["type2",xpos,ypos]];
i create the objects like so;
PHP Code:
for (i=0; i<_root.mission_array[_root.mission].length+1; i++) {
_root.attachMovie("enemy2", "e_"+i, i+200);
_root["e_"+i]._x = _root.base._x+_root.mission_array[_root.mission][i][1];
_root["e_"+i]._y = _root.base._y+_root.mission_array[_root.mission][i][2];
_root["e_"+i].gotoAndStop(_root.mission_array[_root.mission][i][0]);
}
it will do everything except tell the clip to gotoAndStop at the right frame. I can't figue out why it doesn't work. Anyone got the answer?
GotoAndStop Help
Hello, i am new to flash mx 2004, and am stuck on what seems should be straight-forward. I am trying to make a game using tiles, and have a class called buildmap, with the following function
public static function buildGame(map) {
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var i = 0; i<mapHeight; ++i) {
for (var j = 0; j<mapWidth; ++j) {
var name = "t_"+i+"_"+j;
_root.attachMovie("tile", name, i*100+j*2);
_root[name].gotoAndStop((map[i][j]+1));
_root[name]._x = (j*30);
_root[name]._y = (i*30);
}
}
}
but when i test the movie the gotoAndStop() call does not work and it just plays all the frames in the attached movie.
Any ideas??
Gotoandstop On An Mc
I have a flash movie that plays an intro and then stops. the last frame contain buttons etc for navigating the site. The buttons are in a movie clip named menu. when a user clicks a button it loads a new swf over the top of the original intro (stopped frame), amongst other actions see below:
on (press) {
gotoAndPlay(15);
loadMovieNum("wwd.swf", 2);
}
on (rollOver) {
unloadMovieNum(1);
loadMovieNum("navigatewwd.swf", 1);
}
on (rollOut) {
unloadMovieNum(1);
loadMovieNum("infocenter.swf", 1);
}
To these actions i want to add an action to gotoandstop a specified frame (lets say frame 20 for example) on the main intro. (this will be a plain white frame) I want it to do this before loading the movie onto level 2.
does this make sense?
my reason for doing this is so that the main intro frames are not visible behind the movies loaded to level 2. as i transition through the various pages of the site the background (ie the stopped frame of the intro) flashes briefly before the new swf is loaded on level 2.
any help would be greatly appreciated.
thanks
GotoAndStop Won't Go
Hi, please see my coding here. I had applied this script to four of the mc(aboutus,advertiser,history,contactus) but just one of those run this script perfectly, this is funny. Other 3 of them failed to run in the last gotoAndStop(1), that means only 1 of them will go back to frame1, others will not go back. What happen??
Code:
onClipEvent (load) {
_root.closebtn._visible = false;
}
onClipEvent (enterFrame) {
this.btn1.onRelease = function() {
_root.fco.dd += 2;
_root.fco.aboutus.swapDepths(_root.fco.dd);
gotoAndPlay(1);
};
if (this._currentframe == 24) {
_root.closebtn._visible = true;
_root.contents.loadMovie("kocha.swf");
}
_root.closebtn.onRelease = function() {
_root.closebtn._visible = false;
_root.contents.loadMovie("");
_root.fco.aboutus.gotoAndStop(1);//this one will not go and stop on the others 3
};
}
GotoandStop()
Something very very strange has hapened.
My code wont work
Code:
onClipEvent (enterFrame) {
if (!walking) {
if (Key.isDown(Key.SPACE)) {
this.gotoAndPlay(2);
gun++;
_root.gun.duplicateMovieClip("gun"+gun, gun);
_root["gun"+gun]._visible = true;
}
}
Code:
this.gotoAndPlay(2);
That part dont work.
So I want it so when I press SPACE it will go inside my clip and play the shooting anmiation withch is the Second frame.
On that second frame is no stop action nothing.
ANy help.
GotoAndStop(1) Of A Different MC
I have a mc that I use as a stop/play button for music. One the main stage there are 3 of these buttons for 3 different songs. One frame one of each MC there is a triangle for play with this code:
stop();
btn_play.onRelease = function (){
stopAllSounds();
gotoAndPlay(2);
}
Then on frame 2 there is a square for stop with this code:
stop();
btn_stop.onRelease = function (){
gotoAndStop(1);
stopAllSounds();
}
It works fine as far as stopping and playing. The stopAllSounds is to prevent the music from overlapping in case the user didn't press stop before playing a different song.
Here's the problem:
If the user presses play to hear a song then wants to hear another song so he decides to click play on a different song without first clicking the stop button there a problem.
The problem is that he is still stopped on frame 2 of the first song therefor the square is still visible. In this case in order to hear the first song again he would have to double click.
My question is:
Is there any way, from the main timeline, I can tell it onRelease of a specific button within a specific buttion to make a different mc to got frame 1?
GotoAndStop Help
Hello, i am new to flash mx 2004, and am stuck on what seems should be straight-forward. I am trying to make a game using tiles, and have a class called buildmap, with the following function
public static function buildGame(map) {
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var i = 0; i<mapHeight; ++i) {
for (var j = 0; j<mapWidth; ++j) {
var name = "t_"+i+"_"+j;
_root.attachMovie("tile", name, i*100+j*2);
_root[name].gotoAndStop((map[i][j]+1));
_root[name]._x = (j*30);
_root[name]._y = (i*30);
}
}
}
but when i test the movie the gotoAndStop() call does not work and it just plays all the frames in the attached movie.
Any ideas??
Gotoandstop
I have a link that goes to the name 5, that works here:
on (release) {
_root.link = 5;
_root.play();
}
But I want it to go to the Casual frame which is inside of 5, is this possible?
on (release) {
gotoAndStop("casual");
}
How Do I Define The Greatest _x Position Based On A Loop, Assuming I Know The Last Element Of The Loop?
Hello,
This may be complicated,
I've a loop that creates emptyMovieClips
then I use one function to onRollOver _xscale them += 10
Now I want to move another movieClip based on the greatest _x position of my previously _xscaled elements, how do I do that?
example
for (var i = 0; i<my_array.length; i++) {
_root.menu_.createEmptyMovieClip("btn"+i, i+1);
}
//
_root.menu_["btn"+i].onRollOver = function() {
this._xscale += 10;
//
MY_DRAGER._x = HIGHT._x;
}
Can this be done?
Thanks,
|