Flash - Sound within Movieclip plays at random occasions - actionscript-3

Alright so I'm going crazy.
My flash project has 4 different scenes. A homepage and 3 subpages. There's also a navigation bar to switch between pages.
I have a MovieClip on the main page (and only on the main page) which plays on MOUSE_OVER. The MovieClip also contains a sound. The thing works perfectly. Animation and sound are played whenever I rollover. Now the weird thing:
The sound from my MovieClip also plays when I switch between scenes using my navigation bar. But not on every switch, only e.g from Page 1 to Page 3 but not to Page 2. All buttons are using the same function which simply say "gotoAndStop(...)". How can this be??

Related

Frame by Frame animation AS3

This is for AS3 FlashDevelop, Basically I'm super new to this. The most I've done in AS3 coding is display multiple images on a single frame and parallax images.
However I want to know how to display embedded Bitmap (.png pictures) as frames one after another,
like frame 1 = embedded image 1 frame 2 = embedded image 2 (frame 1 is gone but 2 shows) frame 3 = embedded image 3 (and so on.)
and they would continuously play as an animation and stop at the first frame until I press play again
I believe I would use nextFrame, stop and gotoframe but don't know where and what I need to code, I heard of bitmapdata but I'm stuck on how to use it in purpose of animating frame by frame.
EDIT: No I'm not animating sprites, rather it's more like cartoon process where you'll go frame by frame of the image files, as one appear the previous one disappears.
You could iterate through each frame and add the images after you load them.
If you do addChild() it should add it to the current frame you're on. Load the next image with a Loader, place it down with addChild, nextFrame(), and repeat until you have all the images. Then when they're all loaded (from what I guess would be some list you'd have in an array or an xml) take the user to frame 1. You might want to do this inside of a movieclip while having that and a cover graphic on your main stage so the user doesn't see all of the images while they're being loaded and placed.
[More about adding display objects to frames]

Flash Game objects won't go away

I have a flash movie with a interactive game in the middle. The game is a simple drag and drop with a target.
Now to my problem:
When the user plays the game the drag and drop symbols stays in the target spot on the next frame to the end of the movie.
I would like them to disappear after the game is over.
I am a noobie to actionscript 3.0 - is the a code i can implement on the frames after the game to make sure that the objects wont showup.
Thanks..
Frame navigation does not affect objects that were created by code (or even objects that were created by frames but modified by code). So you need to manually remove them via removeChild().

AS3 Timer Class causing odd behaviors, black screen, not starting, etc - Full code available

So I'm trying to use the timer class in a Flash CC AS3 script.
When the SWF loads, it plays this looping video. When the user clicks the video, it goes to the next frame where there are 4 buttons which play movies, and a timer.
The timer is there so that if the user doesn't click after a few minutes (in this case a couple seconds) the SWF returns to frame 1 and plays the looping video, once again, until the user clicks.
After adding this to my COMPLETE and MOUSE_EVENT event listeners...
this(root).attractTimer.start();
when I click on the video, it removes it from stage and I'm again presented with the 4 buttons.
It's at that moment I need it to start the timer once again. If the timer runs out, it needs to gotoAndPlay(1).
I'm banging my head on the desk with this right now.
Looks like I got it working.
The buttons that fire off the video, I was using...
this(root).attractTimer.star();
I didn't need to use 'this'
instead I used
attractTimer.start();

Adobe Flash CS5.5 Actionscript 3 Buttons within movieclips cause swf preview and debugger to freeze

To say i am new to actionscript 3.0 is an understatement. But i am still trying to use it anyway. At the moment i am trying to create an interactive movie, with each frame in the main timeline containing a movieclip, and the movieclips containing the choices are the ones with buttons.
The issue here is simple, when the first button comes up the video freezes, and it seems like i can click the button but nothing happens when its clicked.
I have tried searching for a solution but it seems the only thing that comes up are ways to get the player to freeze when a button is clicked, sort of the opposite of what i'm looking for :)
The code at this point is really simple:
import flash.events.MouseEvent;
import flash.display.MovieClip;
this.Choice1R.addEventListener(MouseEvent.CLICK, ButtonHandler1);
function ButtonHandler1(e:MouseEvent){
MovieClip(this.parent as MovieClip).gotoAndPlay(3);
}
A simple stop(); tag is inside every keyframe in the main timeline to allow the movieclips inside to play, and that's about it. Every layer containing a button at this point looks sort of like this. Choice1R is in this case the instance name. If anyone can think of a reason why this would cause the swf file to freeze, any help would be appreciated.
Note: The sound keeps on playing as normal. No idea why.

How do i get my UILoader to play an .SWF once then disappear?

How do i get my UILoader to play a .swf file once then disappear until called upon again?
I am creating a guitar tutorial app that shows you chords and the transitions between them. to display the chords I'm using standard Flash graphics and for the transitions i am using a UI Loader to display the .swf files for instance, on the C chord frame, the fingers are in position and the UI Loader is a layer on top of it, when the chord transition is selected from the list component it loads the chordtransition.swf.
The problem is that once the swf is loaded it plays on loop, ive added "stop();" in many different places as people suggest and it doesn't make a difference.
I would like to be able to click "C-D" on the component list then for the .swf to play once then disappear.
Any ideas??
A strategically placed stop() should work (last frame on the timeline in the swf). You'll need to stop the right movieclip - if your movie has nested clips you might be stopping the wrong clip.
However, creating multiple swf's just to show different chords looks like overkill to me.
Create clips showing all chords on the main timeline, and add frame labels to indicate where they start and put stop() at the end of every chord animation (are you using animations?).
Use movieclipWithChords.gotoAndPlay("chord_C");
If you are not using animations you can use movieclipWithChords.gotoAndStop("chord_C");
Of course you can also create labels like 'C' and 'D', and use those as a direct mapping of the chords.
Update: After reading your question again I realize you are actually showing clips of a transition from one chord to another. In that case you can still use my suggestion as above, only your labels will not be for the individual chords, but for the chord transitions e.g. 'transition_C-D' or 'transition_G-B'.