Button to play a movie within a movie in ActionScript 3 Presentation - actionscript-3

I am making a Flash Presentation, so each animation is within a movie clip (movie_mc). This movie clip has a key frame holding each animation (4 keyframes/animated slides). The first movie instance/slide is called "slide1871". I labeled the first frame within this movie "slide1871". My buttons are on the main timeline.
I CANNOT get the code to work to link to play the first frame of movie slide1871 (within movie_mc). It either doesn't work at all, or it plays the 4 keyframes of the 4 slides I have within movie_mc.
This plays the 4 keyframes:
btn1871.addEventListener(MouseEvent.CLICK, btn1);
function btn1(event:MouseEvent):void
{
movie_mc.gotoAndPlay("slide1871");
}
I've tried a bunch of other stuff that the button doesn't even work.
Please help, hopefully this makes sense.

Related

On AS3, how go to a specific frame inside multiple movie clips

Hello experienced people, I´m working on a dress up game on AS3.
I need to made a button that removes all clothing.
Over the body base, in the main scene, there´s multiple movie clips for each clothing part (ShirtsMC, PantsMC, ShoesMC, etc) inside every MC there´s frames with clothing but there´s always an empty frame See picture to simulate a removed item.
Each MC has a different number of items, and my question is how/if can this be done, when press that "RemoveAllClothing" button it commands the multiple movie clips to go at that empty frame in each one of the multiple MC.
I´m not really sure how archive this, any help will be greatly appreciated
-Freefox-
Add an empty frame (last frame) to all your objects.
When a button is clicked, set your movie clips to last frame (empty).
removeAllClothing.addEventListener(MouseEvent.CLICK, removeIt);
function removeIt(e:MouseEvent):void
{
ShirtsMC.gotoAndStop(ShirtsMC.totalFrames);
PantsMC.gotoAndStop(PantsMC.totalFrames);
ShoesMC.gotoAndStop(ShoesMC.totalFrames);
}

Accessing animation of nested symbols using AS3 in Flash CS4

It's for my college project again.
I am making a Zombie shoot-em-up game. I created a Zombi symbol with the default Zombie sprite. Inside the symbol I placed three more sprites that are ZombiAttack, ZombiIdle, and ZombiMove, in the frames 1, 15 and 20 respectively. I further converted the sprites to symbols and inside their respective symbols I placed the remaining sprites. So it's like this:
Zombi (Main Symbol):
ZombiAttack (in Frame 1):
inside this I placed the remaining Zombie Attack sprites placed at intervals of 5 frames.
ZombiIdle (in Frame 15):
inside this I placed the remaining Zombie Idle sprites placed at intervals of 5 frames.
ZombiMove (in Frame 20):
inside this I placed the remaining Zombie Move sprites placed at intervals of 5 frames.
In the Zombi Class File I used the following code in the ENTER_FRAME listener's function:
this.gotoAndPlay(20); //For the moving animation of the Zombie.
This plays a static image of the frame 20 and not what's inside it (which I want it to play).
Now, my question is how do I do that? How do I play the nested symbols animation and control it further?
I've found a few posts that address a similar problem but the solution for them isn't working for me as many posts were dated back to 2004 and 2005.
Thanks in advance! :)
Make sure all your symbols are movieclips and give them instance names in the property inspector. (For example, you can name the idle animation "idle_mc").
You could place this actionscript on frame 15:
idle_mc.play();
To make sure that idle_mc plays after the playhead jumps to frame 15. You can also put a play(); command inside the idle animation on frame 1, just to make sure it plays.

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 Actionscript 3.0 MovieClip Transitions (No Buttons)

I have 3 mc_MovieClips.
Each clip is on a different frame of the same layer in the main scene.
I do not want to use a button to control the play.
On startup, I want Clip1(On Frame1) to play, and when that is finished, Clip2(On Frame2) will play and so on.
I am a very beginner and using Flash Professional CC and actionscript 3.0. The only help I can seem to find calls for global variables, which no longer seem to exist.
I can provide more information if needed, I am just a really big beginner.
Try placing a parent.nextFrame(); on the last frame of each MovieClip and a stop(); on each frame of the parent clip (actual frames of your main scene).

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'.