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

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);
}

Related

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().

how do I link a button inside a movie clip into the mainframe (flash CS6 AS3)

i have made a movie clip with some buttons inside. The idea behind this was to allow a scrolling system to be used. The only problem is i can't seem to figure out how to link a button inside a movie clip with a frame from outside of the movie clip and on the main stage.
My code atm is:
stop();
import flash.events.MouseEvent;
sports1.addEventListener(MouseEvent.CLICK,sport1)
function sport1(e:MouseEvent)
{
MovieClip(root).gotoAndStop(sports)
}
What i would like to happen is that each button inside the movie clip will take me to a certain frame on the main stage, like a navigation system. I am really new to flash so i may not understand all the technical terms yet, so be easy on me :)
So if you are creating a Main Movie Clip on the Stage and have inner Movie Clips that are acting as buttons. You want those inner buttons to take you to different frames on the main stage when the user interacts with them.
This is how you would do so.
What you would need to do as you already done give the Main Movie clip holding the inner buttons an instance name sports1 any inner button would also need an instance name say a button has an instance name of mcButton to access that button you would need to call on it like so:
sports1.mcButton.addEventListener(MouseEvent.CLICK,sport1)
sports1.mcButton.buttonMode = true;
then if you want that button when clicked to go to frame 2 on the main stage you would simply do this in the sport1function:
function sport1(e:MouseEvent):void
{
gotoAndStop(2);
}
I threw in the sports1.mcButton.buttonMode = true; that way it shows that it is interactive ie click able

AS3 / Using different movieClips in one frame

For a project I have several movie clips into one frame in those movieClips you will find a button to go to the next movieClip.
All pages (movieClips) overlap each other.
The movie clips in this case are all different pages that I want to connect through a button.
When I click on the button in the movie clip I can not use gotoAndPlay because I want everything in the same frame. I think I should use removeChild for the other movie clips to remove them and only show the one i need when I press the button?
So is there an alternative for gotoAndPlay(); or should i just use removeChild(); if you click the button?
I have little experience with AS3 so I do not know exactly how I should do it.
You can either:
set the visibility with .visible = false/true;
set their alpha with .alpha = 0 - 1; (if they are interactive, they will stay interactive so careful about that)
remove them and add them (as you already proposed)
move them off screen (bad solution)
I would probably set their visibility. Or you can do it with removeChild. There is no gotoAndPlay() for this scenario.

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

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.

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