ActionScript 3.0 :: Getting Script To Stop After MC Reaches X Position
Dec 7, 2009
working on scrolling panel and trying to get the function to stop scrolling when the last frame in one direction is the last left to be displayed so it doesn't keep scrolling infinitely off the stage. here's what I have
rightscroll_mc.addEventListener(MouseEvent.ROLL_OVER, scrollRight);
rightscroll_mc.addEventListener(MouseEvent.ROLL_OUT, rremoveFast);
function scrollRight(e:MouseEvent):void {
[Code].....
View 2 Replies
Similar Posts:
Jun 29, 2007
I've got my preloader working where it loads up the external swf. The thing is what I want to happen is instead of once the loading progress reaches 100% and starts playing my swf, I want the preloader to hold off on playing the Swf and simply allow me to trigger the playback with a button. I can't seem to figure out how to stop the swf from playing once it reaches 100%. here's my code
Code:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target, loaded, total) {[code].........
View 8 Replies
Mar 30, 2009
How would you force a mouse follow movieclip to snap to a x y position if it reaches x y boundaries or perhaps if a button is released the movie clip snaps to a x y position? Of course if the mouse returns to x y boundaries I'd like for the movie clip to follow again.
Right now this is the code I'm using to make the movieclip follow the mouse within x y boundaries:
Code:
onClipEvent (load) {
_x = 0;
_y = 0;
[code]....
View 4 Replies
Feb 24, 2003
The game Iam busy with, it keeps score how do I get the game to stop when it reaches a certain score?
View 3 Replies
May 2, 2003
I have created a scrollable map which moves via mouse down buttons (left, right etc). Problem is I can't get the map to stop its scroll when it reaches its edge.
View 3 Replies
Sep 20, 2008
I hope the following is pretty self explanatory. There is a ball movie clip "mc1" on stage. The addEventHandler simply starts a tween and the ball rolls from left to right until it's off the stage. I'm simply trying to make the clip stop when it reaches a certain x value on stage. I'm trying to teach myself simple techniques for the if statement and loops.
[Code]...
View 13 Replies
May 23, 2011
i have application that streams videos from fms .i try to play video of 240 seconds, but when playback reaches 180 seconds i got NetStream. play. stop . it happens regularly at the same time.why does it happen? is it encoding of the video??
View 4 Replies
Jun 18, 2009
basically on the stage I have my Menu movieclip which is linked to an actionscript class called Menu. Within this I have another movieclip, not linked to actionscript, just a plain old movieclip.
This movie in question is a dialog box, and contains an animation for it popping up, and then going away again. I'm trying to put actions on specific frames to make it stop when it reaches the middle of the animation, then when "ok" is pressed the animation will resume and it disappears again. However the actions on the frames don't seem to be getting executed. I tried putting "this.stop();" on the middle frame, and have since put "trace("hello?");" on all kinds of frames but it doesnt seem that the actionscript is getting called at all.
This is something for work so I don't really want to start sending the .fla file around, but instead is there anything I should know about things which could cause the frame actions to not be executed?
View 2 Replies
Nov 19, 2009
I added a Menu_mc on my stage. Initially, this should be at the center of the stage and when I click on it, it will tween on the upper left corner of the browser. However, when I resize the browser, the Menu_mc goes back to the center of the screen.
I have tried separating a different actionscript file where it is specifically for initialization of the object and another one for resizing. And then when I call it on my main AS file it goes like this:
Code:
// Add the symbols to stage
var Menu_mc = new Menu_MC();
addChild(Menu_mc);
[code]...
But it seems futile.
View 6 Replies
Nov 20, 2007
i'm trying to get a movieclip within a movieclip to stop playing when it reaches its last frame. let me describe my problem: it should start playing when the user rolls over the movieclip that is containing it(i'll call this mc1, and the movieclip within it mc2). i've put a stop action in mc2's last frame but it won't stop and plays again and again. one thing i should point out is that there is a variable in mc1 that tells the movie whether it's ok to play the movie in reverse when the user rolls over mc1, if this is false, that means that it plays normally(not in reverse). i'm using "play()" to play mc1 when the user rolls over it and this is where i think the problem is; even though the last frame of mc2 has a stop action, it is somehow told to play again? anyways, this is just a guess, i haven't figured out why or how to fix it. i'm not sure if my explanation was too hard to understand so i'll try to clarify it if anyone wants me to.
View 1 Replies
Oct 4, 2008
I'm relatively new to actionscript x and y positioning.. and i was wondering how i would go about: after clicking a button, moving to a specific x and y axis and stopping?I am unsure on the coding that i would use..
View 2 Replies
Apr 21, 2010
I have a movieclip instance named "ground" i have it set up so that the ground moves constantly to the left as a scrolling BG. what I want is that when the user presses the "space" button, the ground moves down then back up in a a parabolic path. and it does. but I want the movieclip to stop moving vertically(make dy equal to zero) when it returns to its original y position. how can this be achieved?
Code:
package{
import flash.display.*;
[code].....
View 2 Replies
May 21, 2005
this should be pretty simple for most, but I would like an explanation more than just a quick code fix. I put all the script together for this object, here is the fla. What I want to do is move it up to the y position as it does, but I need the object to move faster and stop there. Since I have given most of script in the main movie, I don't know how to write the script for the button release. All I can get it to do is crawl up with targety=100; but I still have the problem with the mouse follow once my button is pressed.
View 8 Replies
Jul 8, 2004
i have this
onClipEvent(enterFrame){
speed=5;
this._x+=2;
}
i wanna know how do i stop the movie clip in a place?
View 1 Replies
Apr 7, 2008
i have a fish that follows the mouse position. Im working out the angle and distance it is from the mouse cursor and telling it to swim in that direction. But when he gets there he flickers back and forwards. How can i get him to rest/settle at the position until the mouse is moved again.
[code]...
View 3 Replies
Mar 13, 2009
how to stop on rollover this endless vertical slider in fixed centered position?
[Code].....
View 2 Replies
Dec 6, 2008
I just finished a simple music player... For testing purposes. I upload it in the following address:http:[url]....with 10 music songs that I had recorded from radio stations(added the last 2 twice for testing).The problem is that when a song has totally loaded, stop action taken needs about 1 second to be applied!I.e. When I press "STOP", the sound continue to play for 1 sec before stop. When I push "pause" it takes one second for the music to stop!
However when using resume (second time pause) the sound starts instantly! Thus I guess there is an issue with stop()function of the SoundChannel object that I am using to stop the sound. Also notice that when unpause the music, it continue ~one second before the last sound - which means that I saved the soundChannel.position number (and also call soundChannel.stop()) in correct time, but it didn't stop immediately - bug!?
This only happens when the application runs through a browser(plugin v. 10) - programmed in CS3.
PS1. Notice that ,this also happens when I change Volume too. Thus because Stop and Volume are parts of SoundChannel, I guess there might be a bug with SoundChannel in online plugins..... :/
PS2. Notice that ,this also happens when I close the browser (firefox). Even if browser is closed the music continue for 1 sec the same way as when pressing stop!.. Thus I guess it's flash bug!...
View 2 Replies
Jun 12, 2009
I thought I had a handle on the timer class (even just a beginners understanding), but I'm having trouble with it.I have an event listener for the timer and it starts fine i get a delay, then a tween,but when I place a myTimer.stop();in the fuction the listener called (to stop it) it dosent stop.it will repeat placing the first image, and then call the first function again
......Wait its placing the first image in (a couple of lines before the start), so Its restarting the whole movie, not just the function?
myTimer.addEventListener(TimerEvent.TIMER, tweenone)
myTimer.start();
function tweenone (event:Event):void[code]...........
View 6 Replies
Nov 25, 2008
How do I trace the value of an slider when it reaches a new value? So that I can change other properties depending on what value the slider has.
View 1 Replies
Oct 19, 2010
I am placing and modifying a movie clip using actionscript, and I want to know how I can use an if statement with the movie clip ending. I tried using this. but it didn't work:
addChild(thing);
thing.width = (500/3)+25;thing.x = 225;thing.y = 250;trace(thing.totalFrames);if (thing.currentFrame >= thing.totalFrames){ removeChild(thing);
}
It plays and resizes the movieclip, but doesn't get rid of it(i.e. it keeps looping). I also noticed that when I just used removeChild(thing); without the if statement, it only removed the graphics, and not the sound.
View 9 Replies
Dec 3, 2009
I have been playing with this idea for a few hours and now I'm completely miserable,I have two movieclips, mc1 & mc2. mc1 is palying a simple animation.I want to write a script so that when you rollover mc2, it checks mc1's frame number. if mc1's frame number is for example "10", it should play its own animation. otherwise is should wait until mc1 reaches frame "10" then play mc2 animation.
View 1 Replies
May 19, 2009
I have a piece of code like a the end of a timeline, most usually looping back to frame one or a stop() if I let the playhead play through to this frame then flash will freeze!
View 1 Replies
Mar 17, 2010
move picture according to mouse movement.
I have this picture moving based on mouse position. Can anyone tell me how to stop it from moving when the pic reaches the edge of the stage? On the example posted I can't stop it from moving, it goes all over the place.
This is the code I am using now.
Code:
// add listener to the stage to detect mouse movement
stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollPictureLeft);
stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollPictureRight);
stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollPictureUp);
[Code].....
View 2 Replies
Jan 8, 2010
I have a website that loads external .swf files using XML. People viewing my website would have to wait a while for my .swf's to load as some are 5mb plus. Is there a bit of script I can use to say start playback of my .swf when it has loaded 50% of the file?
View 5 Replies
Jun 24, 2010
I have a movie clip on stage which length is 600 frames. I put a actionscript 3 code "stop();)" at the end of movie. it stops when it reaches to 600 frames but it disappears from the stage as well. Which I don't want. It should stop animating but stay with last fram which has a welcome message.
View 1 Replies
Jan 27, 2011
i am creating a movie clip(gotoAndStop1) which when a movie clip reaches x = 0 it will gotoandstop(2).
View 5 Replies
Oct 10, 2009
I'm trying to remove a movie after it reaches a certain size using an event listener, but I can't seem to figure out what listener to use:
[Code]....
View 3 Replies
Jan 20, 2010
I am trying to create an if statement where when the timer reaches 0 seconds it loads level 2. It isn't working.
ActionScript Code:
private var numberOfSeconds:Number = 10;
private var myTimer:Timer = new Timer(1000, numberOfSeconds);
[code].....
View 8 Replies
Jun 25, 2010
So everything works fine except when the preloader reaches 100% the swf already started. below has the action script in the preloader.swf file... in my main movie the first frame has stop();
ActionScript Code:
stop();
var myRequest:URLRequest = new URLRequest("3DFlashFinal.swf");
var myLoader:Loader = new Loader();
[Code]....
View 5 Replies
Aug 15, 2010
I have a rounded rectangle that the x and y values will always stay the same. However it rotates around and it's height is increased (it follows moving targets). (Think of it as a turret that shoots out a beam of light that will always be anchored to the turret on one end but it gets longer and rotates so that it constantly tracks the moving targets) I want to remove the object when it moves off the screen.
Normally I would just do this with:
(if myObject.x >= 550){
removeChild(myObject);
}
and the same for each other direction of the screen. However, as mentioned, it's not the x and y values that are changing - it's the height that's changing.
Now I've tried just swapping out 'x' for height:
(if myObject.height>= 550){
removeChild(myObject);
}
etc. for the rest.
But the problem with that is that if my turret (the anchor point for beam of light) is closer to the edge of the screen (i.e. it's x is 500), then it will take a couple of second's for the light beam's height to reach 550.
View 0 Replies