Posts tagged Flash

Button to go to frame in movieclip

The Flash plugin is required to view this object.

1. Start with 2 buttons and one movieclip on the stage.

2. Insert the “santiago” label on the movieclip timeline.
Double click on the movieclip.
Create a new layer and name it “labels”.
On the frame you want to label, right click and select “insert keyframe”.

With the keyframe selected, go to the properties palette and name it “santiago”.

The timeline should look something like this:

3. Label the instances on the main timeline (scene 1).
Select the button instance on the stage that will take us to frame 15.
In the properties palette, name it “frame_btn”.

Select the button instance on the stage that will take us to “santiago”.
In the properties palette, name it “santiago_btn”.

Select the movieclip instance on the stage.
In the properties palette, name it “movie_mc”.

4. Create a new layer on scene 1 timeline and call it “actions”.

5. Select the actions layer frame and insert the following code using the actions palette:
//———–presets——————–
movie_mc.stop();

//———–listeners——————–
frame_btn.addEventListener(MouseEvent.CLICK, onFrameClick);
santiago_btn.addEventListener(MouseEvent.CLICK, onSantiagoClick);

//———–functions——————–
//go to and stop frame 15
function onFrameClick(event:MouseEvent):void {
movie_mc.gotoAndStop(15);
}
//go to and stop frame laneled “santiago”
function onSantiagoClick(event:MouseEvent):void {
movie_mc.gotoAndStop(“santiago”);
}

Note: If you want the mc to play, rather than stop at the destination frame, change the operation “gotoAndStop” to “gotoAndPlay“.

6. Save .fla and render.
The movie should start in a static state, go to frame 15 or frame “santiago” of the mc when you click on the corresponding button.

Button to play/stop a movieclip

The Flash plugin is required to view this object.

1. Start with a button and a movieclip on the stage.

2. Name the instance of the button.
Click on the button and name it “play_btn” in the properties palette.

3. Name the instance of the movie.
Click on the movie and name it “movie_mc” in the properties palette.

4. Create a new layer on scene 1 timeline and call it “actions”.

5. Insert the following code using the actions palette:

//———–presets——————–
movie_mc.stop();

//———–listeners——————–
play_btn.addEventListener(MouseEvent.ROLL_OVER, onPlayOver);
play_btn.addEventListener(MouseEvent.ROLL_OUT, onPlayOut);

//———–functions——————–
//roll over state
function onPlayOver(event:MouseEvent):void {
movie_mc.play();
}
//roll out state
function onPlayOut(event:MouseEvent):void {
movie_mc.stop();
}

The preset:
Stops the video from playing when the file is first loaded.

The listeners:
Identify the button instance name.add the listener (describe the event, name the function to execute);

The functions:
Name of function (describes the event):only run once {
identify the instance to effect.what it should do;
}

Note: you create the name of the of the instance and the name of the function. The instance names should match (name given to instance through properties palette and in script). The function names should match (listener and function title).

6. Save .fla and render.
The movie should start in a static state, play when you roll over the button, stop when you roll out.

Create a button symbol

The Flash plugin is required to view this object.

1. Draw a square in the center of the stage.
Rectangle tool: turn off outline, click and drag on stage to draw.

2. Convert it to a button symbol:
Right click on the square > convert to symbol > name: square_btn, “button”, ok.

3. Name button and indicate “button” type in dialog box.

(Note that the symbol is stored in the library).

4. Save and render .swf.
The cursor should change to a hand symbol when you roll over the button.

Make the button invisible (when rendered)
1. Go to the square_btn timeline.
Double click on the button symbol on the stage. (Note that it has states, not frames.)

2. Move the graphic from the “up” state to the “hit” state.
Click on the “up” keyframe to highlight it.
Click and drag keyframe to hit state.

3. Return to main stage.

Double click off stage or use embedded thread to click back to scene 1.
(Note that the button should appear as a transparent aqua square).

4. Save and render .swf.
The button should be invisible.

Set different graphics for each button state
1. Go to the square_btn timeline.
Double click on the button symbol on the stage.

2. Insert a keyframe on each state:
Right click on the timeline frame > insert keyframe.

3. Change the color of the square for each state:
Select the keyframe, then select the square.
Change the color using the color palette.

4. Return to main stage.
Double click off stage or use embedded thread to click back to scene 1.

5. Save and render .swf.

ActionScript / by Rob Huddleston (2009)

Visual learners can get up and running quickly on ActionScript programming skills for Flash CS4

If you’re a programmer who learns best when you “see” how something is done, this book will have you up and running with ActionScipt in no time. Step-by-step, two-page lessons show you the core programming foundations you must master to create rich Internet content using the preferred language for work with Flash. The visual approach breaks big topics into bite-sized modules, with high-resolution screen shots to illustrate each task.

You’ll learn such skills as how to add interactivity, animate in code, and work with external content to create Flash projects with pizzazz. Designed for visual learners, with two-page lessons and step-by-step, fully illustrated instructions Covers foundation ActionScript, animating, interactivity, and working with external content Demonstrates using the Actions panel, syntax rules, and essential language foundations Shows how to use variables and arrays; write functions, classes, if/else statements, and loops; and work with static classes such as Math Explores essential techniques such as loading visual aspects at runtime, text from delimited text files and XML, and server-based assets using Flash Remoting Companion Web site features all the code that appears in the text, ready to plug into your Web pages

“ActionScript: Your visual blueprint to creating interactive projects in Flash CS4 Professional” is the visual learner’s way to master ActionScript quickly and easily.

Read more…

ActionScript 3.0: Classroom in a Book / by Adobe (2008)

The fastest, easiest, most comprehensive way to learn ActionScript(R) 3.0 for Adobe Flash CS4 Professional ActionScript(R) 3.0 for Adobe Flash CS4 Professional Classroom in a Book contains 14 lessons. The book covers the basics of learning ActionScript and provides countless tips and techniques to help you become more productive. You can follow the book from start to finish or choose only those lessons that interest you. Learn to add interactivity to Flash files using ActionScript 3.0: Control timelines and animation, write event-handling functions, and control loading of and interaction with data, text, video, sound, and images. “The Classroom in a Book series is by far the best training material on the market. Everything you need to master the software is included: clear explanations of each lesson, step-by-step instructions, and the project files for the students.” -Barbara Binder, Adobe Certified Instructor, Rocky Mountain Training Classroom in a Book(R), the best-selling series of hands-on software training workbooks, helps you learn the features of Adobe software quickly and easily. Classroom in a Book offers what no other book or training program does-an official training series from Adobe Systems Incorporated, developed with the support of Adobe product experts.

Read more…