[F8] MouseY Stop
Hello, Does anyone know how to adjust the bellow code so when I move my mouse along the Y axis it stops the movie clip menu. Any suggestions?
I got this from a tutorial:
PHP Code:
mouseX = _xmouse; menuX = menu._x;
mouseY = _ymouse; menuY = menu._y;
if (mouseX > 550) { diff = (mouseX-550)/15; } if (mouseX < 600) { diff = (600-mouseX)/15; } if (mouseX <= 600 && menuX <= 274) { setProperty("menu", _x, menuX+diff); } if (mouseX >= 600 && menuX >= -1620) { setProperty("menu", _x, menuX-diff); } if (menu._x >= 274) { menu._x = 274; } else if (menu._x <= -1620) { menu._x = -1620; }
gotoAndPlay(2);
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-15-2008, 09:53 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MouseX And MouseY
nevermind....I figured it out. mouseX and mouseY does give the reading on the stage, not the underlying symbol.
Edited: 06/29/2007 at 09:42:11 AM by tag_digital
MouseX And MouseY
Say I wanted to make sure that my mouse was within a certain "square area" of the movie... how would I detect that and then execute a function?
ActionScript Code:
if(mouse is within this area)) { trace("BOOM!");} else { trace("You are not within the bounds!");}
Need To Disable MouseX And MouseY
I'm at my wit's end.
I made this site http://michaelbierman.net for a friend.
I used layers of movie clips.
If you click on "people" for example, you get a dynamic conveyor belt-like nav with thumbnail photos. I used actionscripting to control the mouseX and mouseY properties on that layer. Click on a photo. A layer of bigger photo comes up over it. My problem is that the nav under the large photo still moves an buttons underneath it can still be clicked -- not a good thing.
I want the big photo to come up and the conveyor belt layer to disable the mouseX and mouseY logic. Somebody please teach me how to do this!!!
You can analyze my .fla by downloading it: http://halfalien.com/flashkit/conveyorbelt.fla.zip
HELP!!!
Thanks in advance,
Sean
Follow MouseY Question
hi peeps i wanna ask if there is a better way to code this function
ActionScript Code:
function mouseMoveX (event:MouseEvent):void {
num02N.y = mouseY-140;
num01N.y = mouseY-70;
num00.y = mouseY;
num01P.y = mouseY+70;
num02P.y = mouseY+140;
}
i want my num02N, num01N and the rest of the other stuff to follow my mouse's Y coordinate. is there a better way of coding this line instead of typing each movie clip? same goes for the +70, +140 etc.
is there a way to make a double loop? something like this
ActionScript Code:
while (a < 100){
runtimeCombo.addItem( {label: "Example#" + a } );
a = a + 1;
}
oh and how can i add some delay to these guys (num00, num01N and num01P etc) when following my mouse's Y coordinates
How Do You Track Just The MouseY Movement?
Trying to build a scroller that functions when you mouse over a container and scrolls only when the mouseY position changes. Right now, all I know of is the "mouseMove" event which tracks both the mouseX and mouseY. Also ... any links or tutorials on this sort of script would be helpful. thanks!
DisplayObject MouseX, MouseY, ... MouseDown?
DisplayObject's have MouseX and MouseY getters. This is very helpful sometimes.
Is there a way to easily query input state variables such as MouseDown or KeyDown?
If not, I suppose I need to add listeners for these events, which is fine.
I am just wondering:
why MouseX and MouseY get special treatment without a listener;
if there are other getters for input data without listeners that I don't know about in other parts of as3.
Absolute And Relative MouseX, MouseY Positions
I am making a jigsaw puzzle type of game.
I realize that startDrag() and stopDrag() are the best ways to drag objects (puzzle pieces, in my case) around.
However before I realized this (I am a n00b, BTW) I was using a Timer class and getting the mouse position and setting my piece's position to it as follows:
Quote:
this.x = mouseX;
this.y = mouseY;
This was causing the piece to roughly follow the mouse but it was also jumping wildly across two ends of the stage.
I then discovered what was happening: (mouseX, mouseY) appears to be the position of the uppermost object that is enabled to receive mouse events. So while I thought I was supposed to get the mouse position relative to the stage I was in fact getting the mouse position relative to the piece if I was over it. The code snippet above would then cause the piece to jump to whatever (small) values those represented, like (10, 10) relative to the stage. Then on the next timer event the mouse would be above the stage (because the piece was off in never-never land) and (mouseX, mouseY) would return the stage coordinates, and the above code would result in the piece jumping back under the mouse.
Anyway, I finally solved it with the use of startDrag() and stopDrag(), but not after I had lost nearly a full day. So I'm posting this as a warning, in case it may be of help to someone and prevents them from wasting oodles of time, as happened to me.
I tend to learn by doing but I guess it's also helpful to read a lot beforehand as well.
Flash Player 9/Firefox - Mac, MouseX/mouseY Bug
I've been doing a bunch of experiments using mouseX and mouseY to alter positions of different MovieClips on the stage. I have found everything works perfectly on a PC, but no matter what browser or what Mac I try it on, when I click off of the browser window my mouseX and mouseY locations jump into the millions. Which cause my MovieClips to immediately go off stage.
If I keep my mouse back on the stage for a few seconds they eventually right themselves, but I am finding this to be a huge problem since no one on a Mac can view these files properly if they click off of the stage.
There are definitely other people who have experienced this before, including this guy, who was contacted by Adobe themselves. But that was in September that the issue was known and supposed to be solved. Anyone have any idea if there is a solution to this problem, or have heard of any developments regarding this bug?
It's extremely frustrating, and I haven't been able to work up a decent workaround in the past few days I have been trying to solve it. Thanks in advance!
edit: Also, if you have a Mac and want to try and reproduce the bug yourself, the link below is just one of the many instances I have where this bug occurs.
http://www.thundertech.net/brandon/tilter.html
Edited: 05/12/2008 at 04:08:30 PM by BmBrAnDX
MouseX , MouseY Detection Beyond Stage Boundry?
Hi there,
I've just started dabbling with AS3 coming from Director. Is there a way to
detect the mouse x , y values beyond the edge of the stage? When tracing
mouseX, mouseY on enterframe event the values stick at the last position
within the stage when the mouse roams beyond the stage boundry.
An vague example of usage would be if you had a big movie clip as a custom
cursor, and wanted it to smoothly disappear beyond the stage edge.
Thanks for your help :)
Richard Smith
Background Image Moves Based On MouseX & MouseY
I have a background image which is a movieClip called "skyBg"
I want make that movie clip move in opposite direction...based on movieClip movement.
Here is my idea...
Code:
stage.addEventListener(Event.Enter_Frame, skyMove);
function skyMove (e:Event):void
{
var xDist:Number = (mouseX * 2) / (stage.stageWidth * 0.5);
var yDist:Number = (mouseY * 2) / (stage.StageHeight * 0.5);
skyBg.x = xDist;
skyBg.y = yDist;
}
If anyone can elaborate on this that would be great..
thanks
Stop Actionscript Function At A Specific Frame (stop Looping)
I want to stop an effect at a specific frame but I dunno how.
Do I have to put something in the code?
I'm confused.
Or just tell me how to stop it from looping.
Edit:
Is it possible to attach this to a movie clip? Then i can stop it or use onEnterFrame and then escape();
I actually have no idea what I am talking about. /Edit
Here is one of the code I borrowed:
MovieClip.prototype.placeInSpace = function(id) {
var ratio = this.focaldistance / Math.sqrt(this[id].z * this[id].z);
this[id]._x = this[id].x * ratio;
this[id]._y = this[id].y * ratio;
this[id]._xscale = this[id]._yscale = 1000 / this[id].z;
}
MovieClip.prototype.randomPlace = function(id) {
var radius = this.rmin + (this.rmax - this.rmin) * Math.random();
var polar = 2 * Math.PI * Math.random();
this[id].x = radius * Math.cos(polar);
this[id].y = radius * Math.sin(polar);
this[id].z = this.zmin + (this.zmax - this.zmin) * Math.random();
}
Here's the other code cause I can use two in my movie:
function mover() {
// Move the particle over time
this._y += this.speed;
this._yscale += 10;
this.speed++;
if (this._y>500) {
this._y = 0;
this.speed = Math.random()*10;
this._yscale = 100;
}
}
function starField(x, y, n) {
// Generate a starfield of specified dimensions with n stars
for (var i = 0; i<n; i++) {
var star = this.createEmptyMovieClip("star"+i, i);
var dot = star.createEmptyMovieClip("dot", 0);
star._rotation = Math.random()*360;
star._x = x;
star._y = y;
dot.lineStyle(0, 0xFFFFFF, 100);
dot.moveTo(0, 10);
dot.lineTo(0, 15);
dot.onEnterFrame = mover;
dot.speed = Math.random()*10;
}
}
starField(275, 200, 100);
[F8] Movie Plays > Stop > Reverse > Stop > Play
I am fairly new to involved action scripting. I have successfully scoured flashkit threads for years to get my answers but this one has been driving me crazy for the past couple days. I have tried numerous solutions but none of them do exactly what I am trying to do.
I am creating an online portfolio that I want to control with two buttons that will play forward on release and stop at every piece unless the user is pressing and holding down - I also would like the scrolling animation to play in reverse on press and stop at every piece unless press and hold which happens to be skateboards in this section. I am posting the .fla for this section. This is what I have been able to accomplish so far. I moved everything into the main timeline from a movie clip because I could not get that to work at all. Should I move it back to movie clip? I also want it to stop at the first board.
here is the code I was able to peice together that just plays continously without stops.
Empty movie clip on second frame.
PHP Code:
onClipEvent (enterFrame)
{
if (_root.goBack)
{
_root.prevFrame();
}
else
{
_root.nextFrame();
}
_root.frameNo = "Frame : " + _root._currentFrame;
}
Forward button.
PHP Code:
on (press)
{
_root.goBack = false;
}
Reverse Button.
PHP Code:
on (press)
{
_root.goBack = true;
}
I have only done basic stops; goToAndPLay, getURL and such I am a little out of my league here but I started the ball rolling and would like to make this work as I intended. Any help making this do anything close to what I am describing would be much appreciated
How To Make The Wings Of A Fly Stop When The Flash Movie Stop?
Hello,
I made a simple "Fly Flying" flash animation. The wings of the fly are moving up and down while the fly is flying from one location to the other. My problem is:
The wings of the fly are still moving up and down when the fly is landed on the ground. I tried to add a stop(); action script at the last frame. However the wings are still moving even the movie is stopped.
How can I make the wings stop moving when the flash movie is stop? Please download and take a look at my flash file (fly_flying.fla):
http://space.uwants.com/batch.download.php?aid=313219
Thanks and best regards
Alex
How Can I Stop Flash From Looping And Stop On The Last Frame
I am having a problem with looping. I created a flash file and published it. I only want it to play through once and stop on the last frame. I can't get it to stop, it keeps looping through and playing the movie.
I have tried to add a layer that has some script in it with a start and a last tag on frame 1 and frame 310 there is 315 frames total.
the action script was
<code>
// this was in the first frame
ifFrameLoaded ("last") {
gotoAndPlay("start");
}
//this was in the second frame
gotoAndPlay(1);
//this was in the last frame 315
stop ();
</code>
your help is greatly appreciated.
skj
Cannot Stop Movie Clip - This.stop() Confusion
Hello,
In my pong game when someone scores a goal I want the ball to pause in the middle of the screen, wait xx seconds and then randomly move.
Code:
// Return to kick off position
this.stop();
this._y = 325;
this._x = 275;
a = 0;
var myInterval = setInterval(this, "wait", 30*1000);
This calls function wait that simply uses this.play(); to allow the ball to move again.(See below)
Code:
onClipEvent (load) {
this.wait = function() {
this.play();
clearInterval(myInterval);
};
}
However I cant EVER get the ball symbol to stop no matter what I do.
Ive included all the code attached to the clipevent for the ball below.
Im thinking it must be due to the nested loops or somethings, very very confused
Code:
onClipEvent (load) {
this.wait = function() {
this.play();
clearInterval(myInterval);
};
}
onClipEvent (enterFrame) {
//Kick Off, play whistle and select random direction from 4 diagonals
if (a == 0) {
_root.kickoffwhistle.start();
//Use variable to ensure random numbers are generated only once per game
var randNumber1:Number = Math.pow(-1, Math.floor(Math.random()*2));
//-1 ^1 or ^2 = 1 or -1
var randNumber2:Number = Math.pow(-1, Math.floor(Math.random()*2));
//move it on the y axis at -1 or 1 & //move it on the x axis at -1 or 1
this._y += this.randNumber1;
this._x += this.randNumber2;
++a;
//set a trigger to increment so only actioned once.
}
if (randNumber1>0) {
this._y += this.yspeed;
//move it on the y axis at the set speed
} else {
this._y -= this.yspeed;
//move it on the y axis at the set speed
}
if (randNumber2>0) {
this._x += this.xspeed;
//move it on the x axis at the set speed
} else {
this._x -= this.xspeed;
//move it on the x axis at the set speed
}
// Ball(this) collides with PL1 and ball travelling upwards then deflect off randomly {
if (this.hitTest(_root.P1footballman) && this.yspeed<0) {
// Define boundaries for collision detection
var pl1bounds:Object = _root.P1footballman.getpl1bounds(_root);
this._x = Math.round(Math.random()*(pl1bounds.xMax-pl1bounds.xMin))+pl1bounds.xMin;
//Revert direction of ball by using formula below
this.yspeed = this.yspeed*-1;
//Randomly play miss sound effect if ball in goal area
if (this._x>133 && this._x<450) {
var result = Math.round(Math.random()*2);
if (result == 0) {
_root.MissedGoal.start();
}
}
//play football kick & header sound
_root.footballkickorheader.start();
}
if (this.hitTest(_root.cpu) && this.yspeed>0) {
var cpubounds:Object = _root.P1footballman.getcpubounds(_root);
this._x = Math.round(Math.random()*(cpubounds.xMax-pl1bounds.xMin))+cpubounds.xMin;
this.yspeed = this.yspeed*-1;
if (this._x>133 && this._x<450) {
var result = Math.round(Math.random()*2);
if (result == 0) {
_root.MissedGoal.start();
}
}
//play football kick & header sound
_root.footballkickorheader.start();
}
//Roatation properties of the ball
i = getProperty(this, _rotation);
setProperty(this, _rotation, i+5);
//Rotate ball i degees per frame
_this.rotation = i;
//Player Scores routine
//If ball object is beyond defined CPU goal area
if (this._y<75 && this._x>133 && this._x<450) {
_root.goalcry.start();
_root.P1footballman.score++;
//add1 to the cpu score
_root.playertxt = 'PLY: '+_root.P1footballman.score;
//Play start whistle for KICKOFF
_root.kickoffwhistle.start();
//Return to kick off position
this._y = 315;
this._x = 275;
a = 0;
//Stop ball in correct position
this.stop();
//5 seconds then calls function "wait" to use this.play() to move ball
var myInterval = setInterval(this, "wait", 5*1000);
}
//CPU Scores routine
//If ball object is beyond defined Player goal area
if (this._y>470 && this._x>133 && this._x<450) {
_root.goalcry.start();
_root.cpu.score++;
//add1 to the cpu score
_root.cputxt = 'CPU: '+_root.cpu.score;
//Play start whistle for KICKOFF
_root.kickoffwhistle.start();
// Return to kick off position
this.stop();
this._y = 325;
this._x = 275;
a = 0;
var myInterval = setInterval(this, "wait", 30*1000);
}
if (this._x>620 || this._x<5) {
this.xspeed = this.xspeed*-1;
//if it hits an edge inverse the xspeed
_root.bounce.start();
//Play bounce side effect
}
if (this._y>470 || this._y<75) {
this.yspeed = this.yspeed*-1;
//if it hits the top or bottom of pitch inverse the yspeed
_root.bounce.start();
//Play bounce side effect
}
}
How To Stop MC At Same Time As Sound Stop?
Hi and thanx for u trieing to help me.
I have used this code to play a sound from the library.
with (song_link) {
sound1 = new Sound(song_link);
sound1.attachSound("inga");
sound1.setVolume(100);
sound1.start(0, 0);
}
and when the sound stops i would like to stop a MC that loops.
if there is any way to have an if command in the MC that waits for a variable to be sended and then stops.
or to set some kind of countdown when u start to play the sound that tells the MC to stop.
i would be very glad if u could help me!
Stop Movie - Don't Stop Sound
Hello,
I'm making a intro for somebody's site. The intro plays a loop. At the last frame I made a stop script. But I want to the muis (a loop) to play on and on. So the music won't stop when the movie stops.
Can somebody help me?
Tnx & greetz, Big_Boss_Man
Stop Sounds When Stop Film
Hi. When I open my flash movie in the Flash Player (I have MX) and play it, it works fine. But if I make a breake (stop the playback), the film stops, but the sound still goes on. I have seen animations where sounds and the movie stop if I stop the film. How can I do it. Thx, leu
If I Stop The Sound I Want To Play It From Where Is Stop :)
hi all
i want a button if i cilck on it the sound will stop and another button if i click on it the sound will continue from where it is stoped is it possible in flash or not
and the sound where is the best place i place it ( movie clip - main frame - action ????
thanks
if any one can give me an open file to be clear or the code
How Can I Stop THIS Movie? This.stop() Does No Work?
I try to stop a small movieclip writing
onclipEvent(Enterframe){
if(_root.myvar==1){
this.stop();
//this._visible=false
}
}
It becomes invisible if I use the second line. But it does not stop if I use the first line.
What's the problem??
Thanks
Strange Bug....won't Stop At Stop Action
My movie isn't stopping when there is a stop action. I don't know if its a bug in my site or if its a bug with flash MX. Here is the file home.fla. The error occurs when you click on one of the buttons under the Profile heading. If you look at the Profile Scene you'll see I have stop actions placed at the end of each labeled section. For some reason the philosophy section keeps repeating itself and won't stop even though there is a stop action. Can some please take a look and let me know what I can to fix this. Thanks!!
Movie Won't Stop On Stop Command ?
Hello again. I have a movieclip following a motion guide. At the end of the guide, a window comes up with some text. On this frame, on it's own seperate layer, I have a stop command. What is suppossed to happen is after reading the text, you click on the window, it dissappears, and the movieclip follows another motion guide. For some reason though, when I output the FLA, it blows right past the stop command. I have tried making the stop command multiple frames, and I have double checked that there is no other command overriding the stop on that frame. I have no clue. Any ideas? Thanks,
(I would post the file, but it's so large it's killing my G5)
Movieclip Won't Stop On Stop Command?
Inside a movieclip (track) I have a ball on a motion path. At the end of the first motion path, a box comes up and the movie is suppossed to stop on it. For some reason, it keeps going right on to the next motion path. The stop is on it's own layer, and the weird thing is, there are two other stop commands on the same layer, at the beginning and the end of the movie, which both work. I have tried everything I know. Please help. Thanks,
-A
_root.stop Doesnt Really Stop
Hey guys,
I have a pretty complex game im working on..and when you win the game, it sends you to the 4th frame on the root timeline.
This shows the win message and such...however, it keeps automatically sending them from the 4th back to the 3rd frame. I have been searching thru the flash for hours to find something that is doing this, but there is nothing!
Is there a way to like override all other things and have a FULL stop?
I cleared the intervals (but none of them have anything to do with changing frames) but nothing works.
Any help would be amazing. Sorry I can't post the example, as its a HUGE complex flash file.
I pretty much am looking for something similar to _root.stop that actually stops EVERYTHING.
Thanks!
Goto And Stop Doesnt Stop?
hi there..
i have stupid problem again..
thats very basic and i dont knwo what the hell is wrong and its driving me crazy!
ok here it is.. im using
on (release) {
gotoAndStop("main");
}
it goes back to main labeled frame stops around 3 sec.. then plays the whole movie.. again! and again!
i changed it to frame number like
on (release) {
gotoAndStop(45);
}
still same! even there is a stop(); action on frame 45(main)
what is that?!
what am i doing wrong?
thanks..
Stop Scene Loop Without Stop();
I have an interactive flash application that I'm building, but it's gotten kinda large (~200k) because of one large png file. So, I want to build a preloader for it, but I seem to have some difficulty getting it to a) stop looping back to scene 1, or b) look good if I use stop();
for some reason, the folowing scene's moving elements look crappy if I use stop(); in it's first frame in order to stop it from going back.
I don't want scene 1 to continuously reappear, but stop messes with the moving elements in scene 2.
Any novel suggestions? Thanks in advance for even reading this.
Goto And Stop Doesnt Stop?
hi there..
i have stupid problem again..
thats very basic and i dont knwo what the hell is wrong and its driving me crazy!
ok here it is.. im using
on (release) {
gotoAndStop("main");
}
it goes back to main labeled frame stops around 3 sec.. then plays the whole movie.. again! and again!
i changed it to frame number like
on (release) {
gotoAndStop(45);
}
still same! even there is a stop(); action on frame 45(main)
what is that?!
what am i doing wrong?
thanks..
Making A Stop Button, Or Telling A Button To Stop A Streaming Video
Hello,
I've searched the forums and tried to find an answer to this question, but most of the posts go unanswered or are way beyond my understanding.
I'm using a form based application in Flash professional 8.
I have a .flv video of a movie trailer that I created from Quicktime. I intend to stream this video.
I also have a button called "Trailer". When I click on the "Trailer" button, I see the .flv video I created along with the play/pause control skin that I added in the import video wizard. I press the play/pause button, and the movie plays.
This is as I had expected it to be.
Now, when I want to go to something different, for example clicking a "Photos" button that displays a slideshow, the video continues to play.
Is there a way I can tell the "Photos" button to stop the streaming video?
I've searched the forums, and found a few answers, but I don't really understand them. I added them to the script of the "Photos" button anyways to see if they did anything, and every time the video still kept playing.
Here's what I've tried so far:
------------------------------------------
button.onPress = function (){
player_mc.clearVideo();
}
Where player_mc is the instance name.
-------------------------------------------
Adding a stop component, but this isn't really what I want. I'd like the "Photos" button to stop the movie without the user having to hit a separate stop button.
-------------------------------------------
.stop() and ._visible=false;
I don't really understand this.
-------------------------------------------
removeMovieClip("component_mc");
-------------------------------------------
instance.stop()
From what I understand this is only for adding to a keyframe to stop a movie that's looping, and not for what I would like to do. Is that correct?
-------------------------------------------
I would greatly appreciate any help, not only just for me, but for any other newbie who may run into this problem.
Thanks!
Timing Stop Go Stop Go
I want to create a portion of a page that is like a slide show with a few (10 or so) pictures that show for a few seconds, then disapear, and move on to the next, then loop. Is there a more efficient way to put a delay between the pictures other than adding like 100 frames for each one? I was looking at the setseconds and getsedonds ... would that work? and if so, how? by the way, I cannot lower my fps because I need quick animation else where.
Stop Sounds Causes Flv To Stop Too
Hey Hey!
Got a minor issue that I just can't seem to figure out. I've added piece of background music and created a simple piece of script to stop and start the music, should it irritate the user.
All works fine, however when I'm playing an flv (imported to stage and streamed) the stop function causes the flv to stop playing. It makes no sense to me.
Here's the code for the variable
Code:
var themeSound:Sound = new Sound();
themeSound.attachSound("soundtrack")
and the code for the On the button
Code:
on(release){
with(tracks){
gotoAndStop('on')
themeSound.start();
audiofx_state = 1;
}
}
and the code for the Off button
Code:
on(release){
with(tracks){
gotoAndStop('off')
themeSound.stop();
audiofx_state = 0;
}
}
The audiofx_state I'm using to deactivate the stop and start buttons as I have a small movie clip that changes text from on to off etc.
So as you can see, nothing complicated here. I've never tried to do this before and any help would be appreciated.
**EDIT**
I work fast and found a way around this problem, but I'd still like to know why the way above doesn't work.
To get around the problem I loaded the mp3 file for the background music from and external source rather than the library.
Code:
var themeSound:Sound = new Sound();
themeSound.loadSound("sounds/theme.mp3",true);
themeSound.setVolume(20);
themeSound.stop();
Code:
on(release){
if (audiofx_state == 0){
with(tracks){
gotoAndStop('on')
soundStarted = !soundStarted;
audiofx_state = 1;
}
themeSound.start();
}
}
Code:
on (release) {
if (audiofx_state == 1)
{
with (tracks)
{
gotoAndStop('off');
audiofx_state = 0;
}
themeSound.stop();
}
}
Help: Using Stop() Does Not Stop Movie
Hi,
I'm new to Flash, and have created a movie that I'd like to stop on a certain frame. I've used stop() before in another .fla which worked ok, but currently it doesn't seem to stop this movie at all.
I've created a layer for actionscript only, and through the first part of the movie I use some actionscript to pause the playback - this code is:
Code:
stop();
startTime = getTimer();
this.onEnterFrame = function () {
currentTime = getTimer();
if(currentTime-startTime > 2000) {
play();
}
}
This code works fine, and stops the playback then restarts after 2 seconds.
I placed a stop(); in the same action layer when I reach the main part of the movie, but when I test the movie or publish it, it goes past this point and then eventually loops.
Does the stop() call have to be done in any particular way?
Thanks in advance, especially if I'm asking a stupid question!
Swapping Buttons W/ AS...play To Stop/stop To Play
Hi,
I'm looking for how to swap buttons with actionscript. If my FLV is playing, display the stop button. If it's stopped, display the play button.
Here's my AS so far.
Actionscript Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play("intro.flv");
stopButton.onRelease = function(){
ns.pause();
_root.bulletlist.stop();
isplaying = false;
}
playButton.onRelease = function() {
ns.pause();
_root.bulletlist.play();
isplaying = true;
}
rewindButton.onRelease = function() {
ns.seek(0);
_root.bulletlist.gotoAndPlay(1);
if(isplaying){
ns.seek(0);
}else{
ns.seek(0);
ns.pause();
}
}
Could I get some pointers or a good link?
Thanks!
How To Stop An MC?
Friends:
When I roll-over an MC I want that MC to stop. I know one way to do this is putting an invisible button on the top this MC and give an actionscript such as:
"On Rollover
With MC
GotoAndStop (1);"
WHere at frame 1 it would be a stop.
But I want the MC to stop exactly at the same point than going to frame 1. Is there a way to do this? Also an invisible button on top of another button----will it work?
Hope I am clear,
Thanks,
FK
Stop That Mc
ok, probably a stupid question for all you guru's out there but here it comes: let's say you have the following script attached to a button:
on (release) {
test._y += 40
}
where test is a movieclip...each time you click the button, the movieclip will go down but i want the mc only go down once no mather how many times you click the button.
One at the time!
Why Won't It Stop When I Tell It To?
k, i have NO clue why this isn't working... after my preloader, i want it to go to the next scene and STOP... but it won't stop for some reason, it just keeps playing. Here is the .fla, plz check it out and tell me wuts wrong.
http://www.ronfez.net/Hummercash/test.fla
Thanks,
.//chris
Stop All?
I've got a flash presentation that has multiple movie clips playing at the same time.
Does anyone know a way I can stop ALL the movie clips and then restart them without having everything on the main timeline? Kind of like a "stop all sounds" action, but for movie clips?
Any help asap would be appreciated.
Thanks.
STOP
I'm trying to create a movie with actionscript. I've created buttons that when the user clicks it a text will appear, my problem is how i can get the timeline to stop when it is finished showing the text.
Hope somebody can help me with this...Thank you in advance!
ADM
It Just Won't Stop
I created this simple movie in Flash 5... I threw it into my Dreamweaver doc and uploaded. It just keeps playing over and over.... I would like for this to just play once. Keep in mind I am new to this so be very detailed if there is any kind souls out there willing to help me.
Stop Go..
I got one time line with 100 frames, on the 50 frame i'd like to stop and afther 60 seconds to continue playing.
i'm trying with this script but with no success
time = getTimer();
endtime = 6000;
if (time==endtime) {
}
play();
any help?
How To Stop This?
Hello,
i have this code (letter is a MC and shuffle is a dynamic text variable:
now = setInterval(change, 200);
function change() {
letter.shuffle = chr(random(25)+65);
}
i want to stop the function when the shuffle is equal to a variable named for example targetLetter.
I also would like to choose the letters which can be used in random changing. I would like to use only all "BIG" letters, "#" and the numbers "27".
Thanks,
Miguel
MC Won't Stop
Here's the situation. I have 3 MCs. I want MC one to be draggable and hitTest against MC2. When this happens I want MC3 to go to a frame and stop.
I have MC1 dragging, and the hitTest works (which pleases me because it's my first one), but MC3 plays all the way through.????
Here is the code:
on(press){
startDrag (this, true);
this._alpha =50;
}
on(release){
stopDrag();
this._alpha =100;
}
onClipEvent(enterFrame){
if (this.hitTest("_root.space")){
testspot = _root.bar._currentframe;
_root.bar.gotoAndStop (testspot + 25);
if (testspot > 101)
_root.test.gotoAndStop ("error");
}
}
p.s. Source file is attached.
My Car Won't Stop
Hello all.
I am creating an RPG game (my first) and I have set up a simple collision detection for the boundries and for the pursuing cop cars. The problem is that, when I hit the boundries, my car stops but if I hold down the UP key, it continues to push through them. Does anyone know how to actually kill the forward motion entirely?
Here is the script for the Purple Caddi that needs to stop:
onClipEvent (enterFrame) {
//Collision Testing
if (_root.carmov.hitTest(_root.copmov)){
speed = 0;
}
if (_root.carmov.hitTest(_root.bound1)){
speed = 0;
}
if (_root.carmov.hitTest(_root.bound2)){
speed = 0;
}
if (_root.carmov.hitTest(_root.bound3)){
speed = 0;
}
if (_root.carmov.hitTest(_root.bound4)){
speed = 0;
}
//This code will advance the car forward.
if (Key.isDown(Key.UP)) {
speed += 2;
}
// This will make the car stop fast
if (Key.isDown(Key.SPACE)) {
speed = 0;
}
// This will make the car go backwards
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
//The car will start to slow down after the speed of 25
if (Math.abs(speed)>25) {
speed *= .6;
}
// This will change the angle of the car
if (Key.isDown(Key.LEFT)) {
_rotation -= 30;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 30;
}
// This will make the car move
speed *= 1;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.move.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
}
Thanks all.
Stop Following Me
Gday guys
In my movie i have two vertical rectangles, and each has 5 buttons on it.
When a button is rolled over, i have a block fall from the top and slow down and hover over the button.
I had it working great for my first vertical rectangle but when i set up the second, things went wrong.
Currently, when ever a button is hovered over both blocks fall from the top and move in unison.
I have given both block instances different names......... and the code is below:
onClipEvent (load) {
delay = "2";
}
onClipEvent (enterFrame) {
with (this.servslider) {
_y += (_root.yspot-_y)/delay;
}
}
and the code assigned to each button is:
on (release) {
_root.gotoAndStop("video");
}
on (rollOver) {
_root.yspot = "50";
}
on (rollOut) {
_root.yspot = "0";
}
As my knowledge of scripting is limited i had a freind help me. However i have a feeling that the code is wrong. I don't understand why i have given each block an instance name when it is not be called by the button.
Any suggestions would be great.
Thanks
Chris
It Won't STOP
Hi everyone im making a flash website, i think! and all ive got so far is a piece of script activated by a button which sends the playhead to a certain frame where a new piece of text appears, this works fine. BUT i want the clip to stop once the text has slid in and stopped, so i put a "stop();" script on the keyframe where the text stops, but when i click the button, the gotoAndPlay works but it ignores my stop(); command, WHY!!?
any help much much appreciated!
Cheers
Will
Stop();
I'm new to Flash and actionscript and am having a problem that I am sure is very simple. I just can't work it out. I have a movie and within that movie I have several movieclip symbols each with multiple keyframes. I want the movieclip symbol to stay on frame1 (named start) until a specific event occurs then gotoAndStop on one of the other named keyframes. My problem is, despite my attempts to try and make the symbol movieclip stay put until an event occurs, and my adding stop() in everywhere i can, it just keeps looping. Please help me stop it! It's frustrating me no end!
Stop
Can someone tell me what could possible override the stop(); command?
i have a simple movie that consist of 2 scenes, at the end of scene 2 there's a stop command but when i test run my flash it just ignore the stop and the playback head would go right back to the beginning to scene 1, i have other stop command in different parts of the movie too but just not the one at the last frame, can anyone explain this to me?
thank you very much.
MC Won't Stop :( HELP
I've made some sort of slider, that when you click a button it begins to slide, but i want it to stop during te sliding movieclip...A simple stop doesn't help....???
Is there someone who can check out my .FLA please i'm getting realy crazy over this....
Stop Mc
okay, i have a mc its a box, i want to move it along the screen until it hits the x coordiante 200, i can get it going, but i don't know how to stop it, this is what i have so far
onClipEvent(load) {
setProperty(this, _x, 5);
setProperty(this, _y, 135);
moveSpeed = 5;
}
onClipEvent(enterFrame) {
this._x += moveSpeed;
}
what would i put after
this._x += moveSpeed;
to get it to stop at 200 ???
|