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

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

Related

Avatar Layering and Animating in Flash

So for my latest Flash project, I'm designing a game. The dimetric character can move in 8 directions. I've been given the spritesheets for the hats, hair styles, etc., that the player can wear.
The spritesheets contain the images for each direction, AND they contain four frames of animation (four per direction) for when the player is walking. This is basically the layout of the Spritesheet (and all of the files and "frames" are the same size, which makes things easier):
[IDLE] [WALKING]
[S][SE][E][N][NW][W][S1][S2][S3][S4][SE1][SE2]...
My goal is to embed all of the items in a single file other than the main one. But I need to implement walking animation.
One thought I had is to set the main SWF's framerate to 7 FPS, then use an Event.ENTER_FRAME handler to alternate between the walking ones. Programmatically animating.
Another thought is to create SWFs for each item of clothing, then use motion tweening to move the spritesheet symbol over the stage.
What I'd really like it so avoid using Adobe Animate entirely. Even if there's an approach that requires the use of Flex, I'd take it if it meant saying goodbye to graphically-designing.
using flash builder (flex) does not mean that good bye graphic! there is a relationship between Adobe Flash and any As3 Ide like FlashBuilder or FlashDevelop.
exporting movieclips and everything in library with .swc format, and then importing it by the IDE, read this
My goal is to embed all of the items in a single file other than the
main one. But I need to implement walking animation.
One thought I had is to set the main SWF's framerate to 7 FPS, then
use an Event.ENTER_FRAME handler to alternate between the walking
ones. Programmatically animating.
i dont undrestand! why 7 fps and also why Event.ENTER_FRAME
there might be a character movieclip, whit above frames in its time line, well! to playing any animation (for particular direction) you have to call mc.gotoAndPlay("walk_S"); then it will be played automatically, if you need lower frame rate, only select each frame by mouse pointer and then press [F5] in time line to insert a blank frame gape between keyframes.
as i said before, you must use a callback script at the end frame of the each loop animation like walk_s walk_ne ...
also idle animations must be called like it: mc.gotoAndStop("idle_s");

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 can I send control of the playhead back to a parent timeline from a movieclip using createJS?

I'm making a multi-part introductory animation for a game. It works when I preview in Flash, but not when I export using the CreateJS toolkit to get HTML5 output.
On my scene's timeline, I have this.stop(); on the first frame, as well as a movie clip that contains several seconds of animation (and which may have to change in length as we develop).
My second frame is labeled "sc2" and I would like the animation to pick up there when the first movieclip is finished. To accomplish this, I went into the first movie clip and put this on the last frame:
_parent.gotoAndPlay("sc2");
This works fine in Flash, but perhaps I can't use the _parent object in JS? Is there an alternative way to access the flow of control or another way to accomplish this? My goal is to avoid doing animation on the main timeline and to control the flow by scripting there so that if the length of the individual sections of animation changes, I don't have to change the start and end frames of the various sections in several places.

Why would a keyframe in Flash fail to update an object's position as defined in the keyframe when the play head is sent to that frame?

I have a background MovieClip in a custom button class, which moves the play head to a different frame (via gotoAndStop("framename")) depending on which mouse events it receives.
When the mouse up event is received, it sends the play head back to the "release" frame, where the background should shift back to its original location, but instead nothing happens and the background remains where it was. It's as though Flash is not honoring the background's position defined by the key frame it enters.
The only workaround is to add a frame script to each frame which manually sets the x and y position to what it should be, but this defeats the purpose of using keyframes for the position.
What is going on?
Try calling event.updateAfterEvent(), it's supposed to
Instructs Flash Player or Adobe AIR to render after processing of this event completes, if the display list has been modified.
from here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent.html#updateAfterEvent%28%29
This appears to have been a bug in the Flash IDE, specifically some kind of corruption in a timeline layer.
The corruption originated in Flash CS4, but persisted when opened and compiled in Flash CS5, which is why I suspect it was some kind of content-generation bug, rather than something specific to either IDE version. The IDE probably gets confused when you construct the timeline out of order or drag things around, rename things, copy things in from other files, etc. I think, specifically... it was the fact that I copied this particular object in from another file. And it wasn't even a complex object, it was just a MovieClip that contained a rounded rectangle and had a drop shadow applied, seriously.
Steps I took to resolve the issue were to remove any classes associated with the library item, reverting it back to a standard MovieClip. I then completely removed the problematic layer. I then reassigned the class to the library object and exported it for ActionScript. Finally, I rebuilt the layer from the first frame, adding subsequent keyframes as necessary. I reapplied filters, and adjusted the clips location on each frame.
Now, everything is functioning as expected. The clip's position, filters, etc. are all updated as expected when the playhead moves to any frame. It's working now as expected, so I wasn't doing anything wrong or not possible. It simply must have been some kind of incrementally constructed key framing confusion within the data structures of the IDE. Glad it's working now.

Merging MovieClips into a larger MovieClip

I have these 2 separate FLA (AS3) files and I want to merge them together. One FLA, let's name "Animation.fla", consists of a 1-frame animation with a class assigned to its main stage, let's label it "MainStage.cs." The other FLA file, label it, "Navigator.fla", consists of 3 frames where I have to navigate different frames to get to the animation on the Animation.fla.
I have tried nesting the two but I gain errors when trying to convert the whole Animation.fla to movieclip and put it on the frame of the Navigator.fla. It's seems it's not the correct way to do it.
Please fill me in with ideas on merging animations with Classes since I'm still new to this.
I have tried nesting the two but I
gain errors when trying to convert the
whole Animation.fla to movieclip and
put it on the frame of the
Navigator.fla. It's seems it's not the
correct way to do it.
This is one way to do it. It could be that your code has errors. Please post your code.
In the meantime, check if:
-your MovieClips have instance names
-you are referencing your MovieClips correctly in your code.
You could you create a new movieclip on the stage of Animation.fla and select all of the frames in Navigator.fla, right click and "copy frames". Then go back to Animation.fla and paste them into your new movieclip. This will work if you don't have a main class in Animation.fla.