1. Make a new .fla file. Called 'startstop.fla' (or whatever)
2. Convert your main simulation timeline animation into a MovieClip so that you can import it to your new file.
-- Follow These Steps Link Here --
3. Open your new .fla
4. Make 3 layers: 1. actions, 2. buttons, 3. animation
5. Make a play and a stop button symbol. Animate the OVER state.
6. Add your play and stop buttons to the stage on the buttons layer.
7. Select your buttons on the stage (one at a time). in PROPERTIES, name the Instance Name: stop_btn, or play_btn
8. Place your animation MovieClip onto the stage and into the animation layer. Select the MovieClip on the stage. Name the Instance Name in the PROPERTIES panel name_mc (or whatever)
9. In the actions layer add the following actionscript:
----------------------
var movieclip:MovieClip;
function stopMovieClip(mc:MovieClip):void{
mc.stop();
for (var i:int = 0; i < mc.numChildren; i++)
var mcChild = mc.getChildAt(i);
if (mcChild is MovieClip) stopMovieClip(mcChild);
}
function playMovieClip(mcPlaying:MovieClip):void{
mcPlaying.play();
for (var j:int = 0; j < mcPlaying.numChildren; j++)
var mcPlay = mcPlaying.getChildAt(j);
if (mcPlay is MovieClip) playMovieClip(mcPlay);
}
stop_btn.addEventListener(MouseEvent.CLICK, stopAll);
function stopAll(event:MouseEvent):void
{
stopMovieClip(ball_mc);
}
play_btn.addEventListener(MouseEvent.CLICK, PlayMC);
function PlayMC(event:MouseEvent):void
{
playMovieClip(ball_mc);
}
----------------------
10. In the actionscript change my code/movie names [ written above in bold] with your movie's PROPERTY Instance Names
11. take notes in class.
Thursday, October 13, 2011
Wednesday, October 12, 2011
XML Tutorial
FLASH! FLAAAAASH!
Class Tutorial: Flash with AS3 for Class Oct. 26th
Nicer Tutorial but with OLD code: Flash and XML
Final Date for Project: Nov. 2nd.
Class Tutorial: Flash with AS3 for Class Oct. 26th
Nicer Tutorial but with OLD code: Flash and XML
Final Date for Project: Nov. 2nd.
Wednesday, October 5, 2011
Animations Due for the Simulation
In the C.Galler/Classes/MMP/Simulation Project/Hat_simulation/
See these .fla examples as references.
1. "Pre-Loader" (preloader_complete.fla)
2. "Title" (title.fla)
3. The "Simulation" (ani_all.fla) / movie clip: ani_all
4. The animation for the "over" state on the buttons
---------------------
- You will also need a file for the Directions & Steps (with animations for the step buttons) (directions.fla)
- A Welcome Screen (welcome.fla)
---------------------
How this will all come together: Movie
See these .fla examples as references.
1. "Pre-Loader" (preloader_complete.fla)
2. "Title" (title.fla)
3. The "Simulation" (ani_all.fla) / movie clip: ani_all
4. The animation for the "over" state on the buttons
---------------------
- You will also need a file for the Directions & Steps (with animations for the step buttons) (directions.fla)
- A Welcome Screen (welcome.fla)
---------------------
How this will all come together: Movie
- Pre-loader.fla opens
- hat.fla opens
- title.fla then
- welcome.fla then
- directions.fla THEN
- ani_all on the mouseclick event
Monday, October 3, 2011
Tuesday, September 27, 2011
Introduction to ActionScript
An introduction to ActionScript 3.0 - Link
In-class notes for Play/Stop button: Notes, Final File
Video of the Buttons with AS3 - Link
Video Sample Step-by-Step from the Hat Example
In-class notes for Play/Stop button: Notes, Final File
Video of the Buttons with AS3 - Link
Video Sample Step-by-Step from the Hat Example
Preloaders
http://sectionseven.com/index2.html
old site with preloader: http://www.oddodesign.com/previous/index.html
http://sectionseven.com/index2.html
http://www.escriba.es/base_en.html
The whole article - many more to be found: Smashing Mag
old site with preloader: http://www.oddodesign.com/previous/index.html
http://sectionseven.com/index2.html
http://www.escriba.es/base_en.html
The whole article - many more to be found: Smashing Mag
Friday, September 16, 2011
Adding Sound
Complete Notes & Compression Settings [PDF]
1. Import the sound into the library.
2. Make a new Layer
3. With the new sound layer selected, drag the sound from the Library panel onto the Stage. The sound is added to the current layer.
Each sound be placed on a separate layer. Each layer acts as a separate sound channel.
4. In the Timeline, select the first frame that contains the sound file.
5. Select Window > Properties, and click the arrow in the lower-right corner to expand the Property inspector.
6. In the Property inspector, select the sound file from the Sound pop-up menu.
7. Select an effect option from the Effects pop-up menu:
None
Applies no effects to the sound file. Select this option to remove previously applied effects.
Left Channel/Right Channel
Plays sound in the left or right channel only.
Fade Left To Right/Fade Right To Left
Shifts the sound from one channel to the other.
Fade In
Gradually increases the volume of a sound over its duration.
Fade Out
Gradually decreases the volume of a sound over its duration.
Custom
Lets you create custom in and out points of sound using the Edit Envelope.
Select a synchronization option from the Sync pop-up menu:
Note: If you are placing the sound on a frame other than frame 1 in the main Timeline, select the Stop option.
Event
Synchronizes the sound to the occurrence of an event. An event sound, such as a sound that plays when a user clicks a button, plays when its starting keyframe first appears and plays in its entirety, independently of the Timeline, even if the SWF file stops playing. Event sounds are mixed when you play your published SWF file. If an event sound is playing and the sound is instantiated again (for example, by the user clicking the button again), the first instance of the sound continues to play and another instance begins to play simultaneously.
Start
The same as Event, except that if the sound is already playing, no new instance of the sound plays.
Stop
Silences the specified sound.
Stream
Synchronizes the sound for playing on a website. Flash Pro forces animation to keep pace with stream sounds. If Flash Pro can’t draw animation frames quickly enough, it skips frames. Unlike event sounds, stream sounds stop if the SWF file stops playing. Also, a stream sound can never play longer than the length of the frames it occupies. Stream sounds are mixed when you publish your SWF file.
An example of a stream sound is the voice of a character in an animation that plays in multiple frames.
Note: If you use an mp3 sound as a stream sound, you must recompress the sound for export. You can export the sound as an mp3 file, with the same compression settings that it had on import.
Enter a value for Repeat to specify the number of times the sound should loop, or select Loop to repeat the sound continuously.
For continuous play, enter a number large enough to play the sound for an extended duration. For example, to loop a 15-second sound for 15 minutes, enter 60. Looping stream sounds is not recommended. If a stream sound is set to loop, frames are added to the file and the file size is increased by the number of times the sound is looped.
To test the sound, drag the playhead over the frames containing the sound or use commands in the Controller or the Control menu.
1. Import the sound into the library.
2. Make a new Layer
3. With the new sound layer selected, drag the sound from the Library panel onto the Stage. The sound is added to the current layer.
Each sound be placed on a separate layer. Each layer acts as a separate sound channel.
4. In the Timeline, select the first frame that contains the sound file.
5. Select Window > Properties, and click the arrow in the lower-right corner to expand the Property inspector.
6. In the Property inspector, select the sound file from the Sound pop-up menu.
7. Select an effect option from the Effects pop-up menu:
None
Applies no effects to the sound file. Select this option to remove previously applied effects.
Left Channel/Right Channel
Plays sound in the left or right channel only.
Fade Left To Right/Fade Right To Left
Shifts the sound from one channel to the other.
Fade In
Gradually increases the volume of a sound over its duration.
Fade Out
Gradually decreases the volume of a sound over its duration.
Custom
Lets you create custom in and out points of sound using the Edit Envelope.
Select a synchronization option from the Sync pop-up menu:
Note: If you are placing the sound on a frame other than frame 1 in the main Timeline, select the Stop option.
Event
Synchronizes the sound to the occurrence of an event. An event sound, such as a sound that plays when a user clicks a button, plays when its starting keyframe first appears and plays in its entirety, independently of the Timeline, even if the SWF file stops playing. Event sounds are mixed when you play your published SWF file. If an event sound is playing and the sound is instantiated again (for example, by the user clicking the button again), the first instance of the sound continues to play and another instance begins to play simultaneously.
Start
The same as Event, except that if the sound is already playing, no new instance of the sound plays.
Stop
Silences the specified sound.
Stream
Synchronizes the sound for playing on a website. Flash Pro forces animation to keep pace with stream sounds. If Flash Pro can’t draw animation frames quickly enough, it skips frames. Unlike event sounds, stream sounds stop if the SWF file stops playing. Also, a stream sound can never play longer than the length of the frames it occupies. Stream sounds are mixed when you publish your SWF file.
An example of a stream sound is the voice of a character in an animation that plays in multiple frames.
Note: If you use an mp3 sound as a stream sound, you must recompress the sound for export. You can export the sound as an mp3 file, with the same compression settings that it had on import.
Enter a value for Repeat to specify the number of times the sound should loop, or select Loop to repeat the sound continuously.
For continuous play, enter a number large enough to play the sound for an extended duration. For example, to loop a 15-second sound for 15 minutes, enter 60. Looping stream sounds is not recommended. If a stream sound is set to loop, frames are added to the file and the file size is increased by the number of times the sound is looped.
To test the sound, drag the playhead over the frames containing the sound or use commands in the Controller or the Control menu.
Subscribe to:
Posts (Atom)