Need To Stop My Flash Movieclip Playing
Hi Guys, I am working in flash 8 and have a short movie clip that starts playing interactively when the user rolls the mouse over it's trigger button. My problem is I cant make it stop!! I want it to play for two seconds or so, and then automatically start playing the rest of the animation in the file, but when it gets to the end of the initial movie clip it goes right back to the start and waits for the user to roll over the trigger button again. The current action script I have for the trigger button is
on (rollOver) { tellTarget ("/mymovieclip") { play(); } }
Any advice much appreciated and feel free to talk to me as though I have no idea what Im doing. Many many thanks in advance.
Stuart
P.S If I need to explain more then please ask
FlashKit > Flash Help > Flash General Help
Posted on: 09-24-2008, 05:20 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Stop Movieclip From Playing?
Hi, newbie here. I have a problem stopping or unloading a movieclip. I created an empty movieclip in my main timeline and loaded another movieclip(notswf) into it using the code below.
this.attachMovie("levitate", "home", 2);
stop();
I put the above code in the first frame of my main movie as i want the movieclip "levitate" to start playing automatically
(levitate is the name of movieclip i want to attach)
(home is the name of the empty movieclip)
It works. However how do I stop this movie from playing when I go to another frame or page? Thanks in advance.
Movieclip Stop Playing
ok, 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. if anyone can give me a solution, it would be very much appreciated.
-i'll try to upoad a fla asap
How To Stop A Movieclip From Playing?
hi, I have a movieclip that plays continuesly...
and I have a button to stop the clip but the button is inside the different movieclip...
how do I stop the movieclip playing on its first frame?
location of my clip:
_root.mc_playing ---> this is the clip i want to stop on 1st frme.
and
_root.mc_buttons ---> this is my button controls(inside of this I have a stop btn).
thanks in advance.
Stop Movieclip Playing When You Click Away
I got a movie clip in a time line. I got links pointing to different frame labels and one of them links to a label with this movie clip, everything's works, everthing's great.
BUT I click a link to take me to another point in the timeline, that movie clip I just looked at keeps playing in the background.
How do I avoid that?
Trying To Stop A Movieclip Playing From A Passed Variable
I am working on a goal thermeter where I want to show how well a program has worked.
what I did was create two movieclips. One is the blank thermeter the other is the mercury that has a tween from 1 to 100 frames.
when it loads I can tell the mercury movieclip to gotoandstop("87") and it work great showing the level at 87 percent.
what I want to do is to have it play the movie and then stop at the 87 frame so I get the motion tween effect of the mercury raising instead of just showing the level.
I have tried doing for next loops and setting the frame to play but it does not provide the motion.
Is there a function that is playuntilframe('X") or how could I do what I am trying to do .
Thanks in advance.
[MX04] [MX04] Action Script To Stop A Movieclip Playing
Does anybody know of any actionscript to put on a flash button that will make a movie clip stop playing when rolled over (not an offstate in the clip) but separately on the main timeline? Kind of like a stopallsounds but for a specific movieclip? I have something that is making me crazy!!
How To Stop Clip From Playing In Flash
Hello,
I just inserted a sound file in flash. I pressed enter, and played it to about half way, but when I pressed enter again, the timeline guide stopped, but the music kept on playing, so It is impossible for me to edit. Can someone help me and tell me how to stop this while working in Flash?
Mac Flash 8 Encoded Flv Files Stop Playing Prematurely
I am using Flash 8 to encode flvs from one minute movs on a Mac with 10.3.9.
If I create flvs using Sorenson Squeeze, the flvs made from movs play back completely. However, if I encode flvs from the same movs, the flvs stop playing about 3/4 of the way through the flv.
I have worked with the same development process on Windows in Flash 8 and have not run into this problem. I want to be able to create the flvs with Flash 8 to enable the in file cue point capability of Flash 8.
Any suggestions on a solution?
Thanks!
Mac Flash 8 Encoded Flv Files Stop Playing Prematurely
I am using Flash 8 to encode flvs from one minute movs on a Mac with 10.3.9.
If I create flvs using Sorenson Squeeze, the flvs made from movs play back completely. However, if I encode flvs from the same movs, the flvs stop playing about 3/4 of the way through the flv.
I have worked with the same development process on Windows in Flash 8 and have not run into this problem. I want to be able to create the flvs with Flash 8 to enable the in file cue point capability of Flash 8.
Any suggestions on a solution?
Thanks!
James
jamesk@pacificmm.com
[Flash Cs3] If This Movieclip Is Playing, Then Play This
Hi, I'm new to the forums and kind of new to actionscript. I need to know how to make a button called Textchange that detects if the movie clip Meditext is playing, and if it is then largetext will start playing and Meditext will stop. But if it isn't playing, then nothing happens.
I tried this previously, but it didn't work for me.
Help With Flash Timeline And Playing Movieclip....
OK here's the situation...My Movieclip is 50 Frames long. I want to be able to play the MC and stop at Frame 25 where the movie displays 3 buttons. From this point I want the buttons to be able to go to their respective scenes. But I want the MC to finish playing the rest of the Movieclip...Is this possible??
Stop Playing
Hi,
What code can I used to tell a mc to stop playing once the button is clicked. My problem is that the mc is still playing once the button is pressed...I need to have it stop on command.
Thanks for your help!
Swf Won't Stop Playing
Hello I have an external movie that I am player in another swf.
I would like to stop the swf when its sequence finishes but it just seems to stick around and not finish. I.e when the movie is done it dosn't dissapear in the other movie clip. I know this should work because my other swfs work fine. The difference with this one is that it has a control bar inside it that is used to rewind, fast forward, ect.
I am not sure how to unload this clip inside the file itself. I cannot change the script in the main swf though this needs be done from the external file (the one with the control bar that is being loaded into the main movie).
Here is the script from the external swf with the control bar that is being loaded in. Any ideas?
Frame Actions:
_parent.stop();
faderbackground._width = width;
looping = false;
playing = false;
top = knob._y;
bottom = knob._y;
left = knob._x;
faderWidth = faderbackground._width-knob._width;
segmentWidth = faderWidth/_parent._totalframes;
right = knob._x+faderWidth-segmentWidth+1;
faderbackground._width -= (segmentWidth-1);
with (backing) {
_width = Math.abs(_x)+faderbackground._width+((_height-faderbackground._height)/2);
shadow._width = _width;
}
_parent.onEnterFrame = function() {
if (_parent._currentframe == _parent._totalframes && !looping) {
playing = false;
_parent.stop();
}
if (dragging) {
playing = false;
_parent.gotoAndStop(Math.ceil(knob._x/segmentWidth));
} else {
knob._x = (_parent._currentframe*segmentWidth)-segmentWidth;
}
//
playhilite._visible = playing;
loophilite._visible = looping;
//
};
//
// playback controls
loop.onRelease = function() {
loophilite._alpha = 100;
};
loop.onPress = function() {
looping = !looping;
loophilite._alpha = 0;
};
playButton.onPress = function() {
playhilite._alpha = 0;
};
playButton.onRelease = function() {
playhilite._alpha = 100;
playing = true;
_parent.play();
};
playButton.onDragOut = function() {
playhilite._alpha = 100;
};
playButton.onDragOver = function() {
playhilite._alpha = 0;
};
stopButton.onRelease = function() {
playing = false;
_parent.stop();
};
rewind.onRelease = function() {
playing = false;
_parent.gotoAndStop(1);
};
stepBack.onRelease = function() {
playing = false;
_parent.prevFrame();
};
stepForward.onRelease = function() {
playing = false;
_parent.nextFrame();
};
goToEnd.onRelease = function() {
playing = false;
_parent.gotoAndStop(_parent._totalframes);
};
knob.onPress = function() {
_parent.stop();
startDrag(knob, false, left, top, right, bottom);
dragging = true;
};
knob.onRelease = function() {
stopDrag();
dragging = false;
};
Please STOP Playing
It just keeps on looping.
I even tried an action script in the last frame.
Please help me make it stop. I was hoping something in properties or export values, but cant locate it.
Newbie here...I apologize.
~W
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
How To Play/stop A Movieclip Inside A Movieclip?
This is probably really simple and stupid but I can't figure it out. I'm trying to play a movieclip exported from my library which inside a movieclip on the stage.
Code:
//create container MC
var myContainer:MovieClip = new MovieClip();
stage.addChild(myContainer);
//bring in animated MC from library and load into container
var myAnimatedMC:AnimatedMC = new AnimatedMC();
myContainer.addChild(myAnimatedMC);
//play mc?
myContainer.myAnimatedMC.play();
The movieclip is added onto the stage but it just won't play. The last step doesn't work? Any ideas?
Long MP3 Won't Stop Playing
Hi, forum. First of all, bless all of you old salts who make a bee-line to the Newbies threads to read the likes of this. You're the class I should be taking at the local BOCES, but for lack of $.
Anyway, today I placed a 4-minute-long piece of music, an MP3 with top resolution (iTunes), onto a layer, to read the track onto an exposure-sheet. (Anyone remember those?) The song shows up as a single frame. I hit the Play button on the control panel, and the music plays. I hit anything else, or attempt to scratch with the red frame marker, and nothing happens. It keeps going till the end, or till I quit Flash.
My equipment: iMac, 256mb, Flash 5. My education: the manual.
Rick Wolff
How Can I Stop Sound From Playing
I got a simple question - I bet you have a simpler answer
What I want..
-------------------
Make an animated gif of a flag move when u have the mouse over the button(gif)and at the same time play the national anthem until you remove the mouse away from the button - then the music and animation should stop.
What I have done..
-------------------
a)Made a MC (flag_move) and imported the animated flag.gif to the MC. Also imported the anthem.mp3 file. Added a new layer and at the first frame on that layer I put the mp3 with sync:start
b)Created a button (flag_butt). At the "UP"-state I hade a gif of the flag not moving. On the "OVER"-state I placed my MC (flag_move). "DOWN"- and "HIT"-state I left alone.
c)Placed an Instance of the button on the stage
What happens..
-------------------
When I move the cursor over the flag it starts to animate it and the anthem plays just like I want - BUT - when I remove the cursor from the button-instance the music continues until the mp3 is done. NOW What/How should I do to get the music to stop at the same time my marker leaves the buttonarea ????? ??
Stop MC Playing Again In Scene 2
Hi
I need assitance figuring this out.
I have a Flash MX movie that contains a movie clip.
In scene 1 the movieclip plays.
When It finishes, it goes to scene 2 and stops.
However because the animation has been put into a movie clip, in scene 2 the animation plays again.
How can I make the movieclip in scene 2 goto its last frame?
One answer is not to use scenes which I would prefer not to do.
Thanks
Stop And Clear MC From Playing
I have an MC called MCShip.
I want to assign a button an Action Script ... that onPress, the MCShip movie clip will stop playing and clear itself from the screen.
How do I type that Action Script?
Playing To Last Frame, Then Stop..
Well as the title says, when i push a button, i want a movieclip to play to the end of its timeline and then stop. (its constantly looping now). I would guess that and action saying gotoendAndStop(u get the idea) or something like that would be what i need.
Remember i cant just use stop in the timeline cause of the loop. Or maybe if i could activate a stop function when i hit a button?
Thanks in advance...
-Bad fish
Button - Stop The Currently Playing Mc...
Hi,
I have a complex timeline with many different MCs playing, telling each other to play when they end, and advance on the main time etc etc.
I have a global stop (and play) button. Is there a way to make this button "smart" as in
code:
on(release){
// look for the value of _root.CurrentlyPlayingMC and stop it
_root.CurrentlyPlayingMC.stop();
}
How do I set the value of 'CurrentlyPlayingMC' to the currently playing MC?
I tried adding a _root.CurrentlyPlayingMC = "introduction"; at the beginning of the MC (changing the variable value for each MC) but the button didn't do anything.
I so close to this project I am forgetting my AS. Maybe someone with less on their plate can help me out
Thanks,
/Flip
Song Stop Playing
How to make the song stop playing when going to next scene?
any scripting ?
Stop Sound Playing Over The Top Of Itself
Okay, i really need some help on this. I have a play button where if clicked will play the sound over the top of it when its already playing, if that makes any sense. the sound is already called on the first frame. if the user clicks the play button again, it will play over it.
heres my play button code. i need to know what to add to add to make it check to see if the audio is already playing. My audio sound is named myMusic.
on (press) {
if (playing != true) {
if (paused != true) {
playing = true;
paused = false;
stopped = false;
myMusic.start(0, 999);
}
if (paused == true) {
playing = true;
paused = false;
stopped = false;
myMusic.start(myMusicPosition, 0);
_root.myMusic.onSoundComplete = function() {
myMusic.start();
};
}
}
}
Thanks
Timeline Keeps Playing Even With Stop();
I've added a file, its going to be a game, but i have a problem with it:
After the power goes down to 0 (if u collide with enemy power goes down) the game takes you to the loosing screen, and there's a "replay" button there. When pressed it supposed to take you to the first frame of the main time line, but it starts looping for some reason. please help, thank u
How Do I Stop A Movie From Playing Over And Over
I have a square movie in the center of my page, i want it to animate anytime i resize the window, but i want it to animate only once, but it keeps going and going everytime i resize the window, how do i make it to play only once?
this is my actionscript:
stop();
square_mc.stop();
Stage.scaleMode = "noScale";
Stage.align = "LT";
Stage.height = 100;
Stage.addListener(square_mc);
square_mc.onResize = positionSquare;
function positionSquare()
{
square_mc._x = Stage.width/2 - (square_mc._width/2);
square_mc._y = Stage.height/2 - (square_mc.height/2);
square_mc.play();
}
positionSquare();
square_mc.stop();
Stop 1 Sound, But Keep Playing Another
Hi all.
I've a real headache with this one.
I have a preloader, with a sound loop - once the main stuff kicks in there's a video with voice over.
Now once the video kicks in, i want the previous sound loop to stop.
Its just not having it - its all or nothing.
Any ideas please?
I'm using flash mx2004, ta.
Stop BGM When Video Is Playing.
How should build my flash when I need my bgm to stop playing when a video clip is playing and start again when no video clip is playing. My bgm is on the main timeline and the action scrip is with in a movie clip (button).
Button Won't Stop Playing
Hello I'm new here and i figured some of you smart people out there may be able to help me or at least guide me in the right direction.
My problem is that i have a button which in the over state has a movie clip on it. I also put an action on it so when you rollover it it plays a motion tween. Everything works great except if you hold the mouse over the button it will continue to play the same movie and tween over and over again. I put a stop in every place i could think of and it just won't work. any tips would be greatly appreciated.
Thanks
Video Won't Stop Playing
Hello,
i have posted this one before, but didn't get an answer, i will try to be clearer.
i have a flvplayback on my timeline which auto loads a video. On another layer at frame 20 there is a stop command. So, the timeline stops at frame 20 but the video continues playing, all is well. There is a button on the stage that resumes the timeline by telling it to gor to frsme 21. At this point i would like the video to stop and disapear. I have tried several things, but nothing works. Please help!
thanks
Stop FLV From Playing When Clicking Away
I got this flv clip which plays on page load and have put the below code in on the keyframe where I have the flv clip. I've done it before (a while ago) where it worked just fine, now it doesn't.
Can anyone see what I'm missing?
PHP Code:
this.addEventListener(MouseEvent.CLICK, clickAway);
function clickAway(event:MouseEvent):void
{
instanceName.stop();
}
This is the error I get:
PHP Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at videoclip_fla::MainTimeline/clickAway()
Non-Stop Sound Playing ...
hi ,
i want 10 wav.z get played without any delay ,
i have a 200 kb wav .. and then 9 .. 100 kb wav z
the first one will be played with a preloader and other ones should be loaded while the first one is playing , so after the first one is finished the sound will be continued ... ( i know how to attach the preloader to the first wav whay should i do about the other parts )
I got 5 days to find the answer ...so i really need any help possible.
thnk u
Stop 1 Movie When Playing Another
I have a project with 5 flv files in it. I have buttons to take the user to whichever clip they would like to hear (they are audio only, with controllers).
The problem is, once you have started any of the clips playing, if you click to go to another one, the first one continues to play at the same time. Is there a simple script to tell whatever may already be playing to stop before the other one begins?
This is my first Flash project,btw-- I don't know anything! :)
Can't Stop The Videos From Playing
Hello, I was wondering if anyone could help me. I have quite a few videos on my web pages but they play automatically when i get to the page. and all play at once. Im trying really hard to stop them so this doesn't happen. Ive tried using the behaviors and actions but nothing is working. Could anyone help?
Need To Stop Audio Playing
Hi, I'm building a Flash website.
I've used frames with names to contain the different 'pages' of the site. On the frame called 'SVHS1' I've built an XML mp3 player with buttons and a volume slider.
If I press the stop button on my mp3 player and then navigate to another frame (any frame before or after ‘SVHS1’) the site works fine, and the mp3 player works perfectly if I go to that frame again. But if I navigate to another frame without first stopping the song it continues to play even though I’m not on the mp3 player frame, and if I go back to the mp3 player before the song has finished it starts playing automatically from the beginning of the first song in the XML list again and simply doubles up the sound, which is horrible. When this happens the playback controls only affect the 2nd version (understandably).
Naturally, I don't want to the user to have to press the 'Stop' button before navigating elsewhere in the site. I think this is probably quite simple to fix and I assume that I have to write some script (an eventListener and function similar to that which allows the 'stop' button to work) that tells the mp3 player to stop playing if/when the user navigates away from that frame...but I don’t know how to do this.
Any help would be much appreciated.
Thanks
Ben
The attached script is for the mp3 player frame.
Attach Code
SVHeadline1.addEventListener(MouseEvent.CLICK, SVHeadline1Clicked);
SVHeadline2.addEventListener(MouseEvent.CLICK, SVHeadline2Clicked);
var getYoutube:URLRequest = new URLRequest("http://uk.youtube.com/user/PollingStationProds");
SVHeadline3.addEventListener(MouseEvent.CLICK, SVHeadline3Clicked);
function SVHeadline1Clicked(event:MouseEvent):void
{
gotoAndPlay("SVHS1");
}
function SVHeadline2Clicked(event:MouseEvent):void
{
gotoAndPlay("SVHS2");
}
function SVHeadline3Clicked(event:MouseEvent):void
{
navigateToURL(getYoutube);
}
volume_mc.slider_mc.useHandCursor = true;
var musicReq:URLRequest;
var music:Sound = new Sound();
var sc:SoundChannel;
var currentSound:Sound = music;
var pos:Number;
var songPlaying:Boolean = false;
var xml:XML;
var songlist:XMLList;
var currentIndex:Number = 0;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, whenLoaded);
function whenLoaded(e:Event):void
{
xml = new XML(e.target.data);
songlist = xml.song;
musicReq = new URLRequest(songlist[0].url);
music.load(musicReq);
sc = music.play();
title_txt.text = songlist[0].title;
artist_txt.text = songlist[0].artist;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
loader.load(new URLRequest("PSPjukebox.xml"));
mp3btn_FF.addEventListener(MouseEvent.CLICK, nextSong);
mp3btn_RW.addEventListener(MouseEvent.CLICK, prevSong);
mp3btn_PAUSE.addEventListener(MouseEvent.CLICK,pauseSong);
mp3btn_STOP.addEventListener(MouseEvent.CLICK,stopSong);
function nextSong(e:Event):void
{
if (currentIndex < (songlist.length() - 1))
{
currentIndex++;
}
else
{
currentIndex = 0;
}
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].url);
var nextTitle:Sound = new Sound(nextReq);
sc.stop();
title_txt.text = songlist[currentIndex].title;
artist_txt.text = songlist[currentIndex].artist;
sc = nextTitle.play();
songPlaying = true;
currentSound = nextTitle;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
function prevSong(e:Event):void
{
if (currentIndex > 0)
{
currentIndex--;
}
else
{
currentIndex = songlist.length() - 1;
}
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].url);
var prevTitle:Sound = new Sound(nextReq);
sc.stop();
title_txt.text = songlist[currentIndex].title;
artist_txt.text = songlist[currentIndex].artist;
sc = prevTitle.play();
songPlaying = true;
currentSound = prevTitle;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
function pauseSong(e:Event):void
{
pos = sc.position;
sc.stop();
songPlaying = false;
mp3btn_PLAY.addEventListener(MouseEvent.CLICK,playSong);
}
function playSong(e:Event):void
{
if(songPlaying == false)
{
sc = currentSound.play(pos);
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
songPlaying = true;
mp3btn_PLAY.removeEventListener(MouseEvent.CLICK,playSong);
}
}
function stopSong(e:Event):void
{
sc.stop();
pos = 0;
songPlaying = false;
mp3btn_PLAY.addEventListener(MouseEvent.CLICK,playSong);
}
//----VOLUME----//
var dragging:Boolean = false;
var rectangle:Rectangle = new Rectangle(0,0,75,0);
volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragIt);
volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_UP,dropIt);
stage.addEventListener(MouseEvent.MOUSE_UP,dropIt);
function dragIt(e:Event):void
{
volume_mc.slider_mc.startDrag(false,rectangle);
dragging = true;
volume_mc.slider_mc.addEventListener(Event.ENTER_FRAME, adjustVolume);
}
function dropIt(e:Event):void
{
if (dragging)
{
volume_mc.slider_mc.stopDrag();
dragging = false;
}
}
function adjustVolume(e:Event):void
{
var vol:Number = volume_mc.slider_mc.x / 75;
var st:SoundTransform = new SoundTransform(vol);
if (sc != null)
{
sc.soundTransform = st;
}
}
Need To Stop Audio Playing
Hi, I'm building a Flash website.
I've used frames with names to contain the different 'pages' of the site. On the frame called 'SVHS1' I've built an XML mp3 player with buttons and a volume slider.
If I press the stop button on my mp3 player and then navigate to another frame (any frame before or after ‘SVHS1’) the site works fine, and the mp3 player works perfectly if I go to that frame again. But if I navigate to another frame without first stopping the song it continues to play even though I’m not on the mp3 player frame, and if I go back to the mp3 player before the song has finished it starts playing automatically from the beginning of the first song in the XML list again and simply doubles up the sound, which is horrible. When this happens the playback controls only affect the 2nd version (understandably).
Naturally, I don't want to the user to have to press the 'Stop' button before navigating elsewhere in the site. I think this is probably quite simple to fix and I assume that I have to write some script (an eventListener and function similar to that which allows the 'stop' button to work) that tells the mp3 player to stop playing if/when the user navigates away from that frame...but I don’t know how to do this.
Any help would be much appreciated.
Thanks
Ben
The attached script is for the mp3 player frame.
Attach Code
SVHeadline1.addEventListener(MouseEvent.CLICK, SVHeadline1Clicked);
SVHeadline2.addEventListener(MouseEvent.CLICK, SVHeadline2Clicked);
var getYoutube:URLRequest = new URLRequest("http://uk.youtube.com/user/PollingStationProds");
SVHeadline3.addEventListener(MouseEvent.CLICK, SVHeadline3Clicked);
function SVHeadline1Clicked(event:MouseEvent):void
{
gotoAndPlay("SVHS1");
}
function SVHeadline2Clicked(event:MouseEvent):void
{
gotoAndPlay("SVHS2");
}
function SVHeadline3Clicked(event:MouseEvent):void
{
navigateToURL(getYoutube);
}
volume_mc.slider_mc.useHandCursor = true;
var musicReq:URLRequest;
var music:Sound = new Sound();
var sc:SoundChannel;
var currentSound:Sound = music;
var pos:Number;
var songPlaying:Boolean = false;
var xml:XML;
var songlist:XMLList;
var currentIndex:Number = 0;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, whenLoaded);
function whenLoaded(e:Event):void
{
xml = new XML(e.target.data);
songlist = xml.song;
musicReq = new URLRequest(songlist[0].url);
music.load(musicReq);
sc = music.play();
title_txt.text = songlist[0].title;
artist_txt.text = songlist[0].artist;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
loader.load(new URLRequest("PSPjukebox.xml"));
mp3btn_FF.addEventListener(MouseEvent.CLICK, nextSong);
mp3btn_RW.addEventListener(MouseEvent.CLICK, prevSong);
mp3btn_PAUSE.addEventListener(MouseEvent.CLICK,pauseSong);
mp3btn_STOP.addEventListener(MouseEvent.CLICK,stopSong);
function nextSong(e:Event):void
{
if (currentIndex < (songlist.length() - 1))
{
currentIndex++;
}
else
{
currentIndex = 0;
}
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].url);
var nextTitle:Sound = new Sound(nextReq);
sc.stop();
title_txt.text = songlist[currentIndex].title;
artist_txt.text = songlist[currentIndex].artist;
sc = nextTitle.play();
songPlaying = true;
currentSound = nextTitle;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
function prevSong(e:Event):void
{
if (currentIndex > 0)
{
currentIndex--;
}
else
{
currentIndex = songlist.length() - 1;
}
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].url);
var prevTitle:Sound = new Sound(nextReq);
sc.stop();
title_txt.text = songlist[currentIndex].title;
artist_txt.text = songlist[currentIndex].artist;
sc = prevTitle.play();
songPlaying = true;
currentSound = prevTitle;
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
function pauseSong(e:Event):void
{
pos = sc.position;
sc.stop();
songPlaying = false;
mp3btn_PLAY.addEventListener(MouseEvent.CLICK,playSong);
}
function playSong(e:Event):void
{
if(songPlaying == false)
{
sc = currentSound.play(pos);
sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
songPlaying = true;
mp3btn_PLAY.removeEventListener(MouseEvent.CLICK,playSong);
}
}
function stopSong(e:Event):void
{
sc.stop();
pos = 0;
songPlaying = false;
mp3btn_PLAY.addEventListener(MouseEvent.CLICK,playSong);
}
//----VOLUME----//
var dragging:Boolean = false;
var rectangle:Rectangle = new Rectangle(0,0,75,0);
volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragIt);
volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_UP,dropIt);
stage.addEventListener(MouseEvent.MOUSE_UP,dropIt);
function dragIt(e:Event):void
{
volume_mc.slider_mc.startDrag(false,rectangle);
dragging = true;
volume_mc.slider_mc.addEventListener(Event.ENTER_FRAME, adjustVolume);
}
function dropIt(e:Event):void
{
if (dragging)
{
volume_mc.slider_mc.stopDrag();
dragging = false;
}
}
function adjustVolume(e:Event):void
{
var vol:Number = volume_mc.slider_mc.x / 75;
var st:SoundTransform = new SoundTransform(vol);
if (sc != null)
{
sc.soundTransform = st;
}
}
Movie Should Stop...but Keeps Playing
ok...I promise...I'm not on drugs.
I also apologize for the length of this...but I have to explain.
This is driving me nuts....I've done a simple presentation....large, but simple.
It's basically a demo of a product that tracks trucking fleets via GPS.
Anyway, the movie starts....goes to a certain keyframe, loads all the pretty graphics and such and the navigation, then....STOPS....waiting for a mouse click on one of the buttons. So far so good.
Now....if you click the "View Demo" button, it simply jumps down the timeline...and starts playing the demo movie...like it's supposed to.
Here's where the weird stuff starts.
Within this demo movie...I have a simple button, that allows the user to escape the demo....when clicked...it simply goes back to the begining of the timeline to a particular keyframe with a stop action on it.
And then....it stops....All good so far.
However, after a few seconds....maybe 5 or 10....it starts the demo again....just jumps down the timeline and starts playing again!!!!....There is no fancy Action Script or anything.....I'm very confused.....and am hoping that someone may shed a little light on this.
The file is huge...so posting it is no good.
Anyone?
Stop Sound Playing Over The Top Of Itself
Okay, i really need some help on this. I have a play button where if clicked will play the sound over the top of it when its already playing, if that makes any sense. the sound is already called on the first frame. if the user clicks the play button again, it will play over it.
heres my play button code. i need to know what to add to add to make it check to see if the audio is already playing. My audio sound is named myMusc.
on (press) {
if (playing != true) {
if (paused != true) {
playing = true;
paused = false;
stopped = false;
myMusic.start(0, 999);
}
if (paused == true) {
playing = true;
paused = false;
stopped = false;
myMusic.start(myMusicPosition, 0);
_root.myMusic.onSoundComplete = function() {
myMusic.start();
};
}
}
}
Thanks
Stop A MC From Looping Or Playing
how to stop a movie clip from playing or looping?
i have main movie clip, i use looping to insert 'pass' movie clip into it, in 'pass' movie clip, there is a script to make 'pass' movie clip to move around, here is the logic
setinterval(move,1)
function move()
{
...........
..........
...........
.........
setinterval(rest,2000)
function rest()
{
..............................
..............................
..............................
if (pass._y == yyy)
{
//stop this pass movie clip from looping or moving or interval
}
}
}
any idea, thanks
Stop A Movie From Playing
Hi
I have this clock which I just want the hand to move only by 180 degrees
So I have this code like ( not complete code here)
Code:
this.createEmptyMovieClip("myclock", 3);
/*..
...
.. some code here and then
*/
myclock.onEnterFrame = function () {
myclock.secondsHand._rotation+=1;
if( myclock.secondsHand._rotation==180)
{
trace("Wow");
myclock.stop();
}
}
but this is not working
Can someone tell me how I can stop it at 180?
I do get a trace "Wow" but it keeps on playing
Thanks
|