Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Flash and ActionScript are ideal for creating flexible, easily updatable web sites that are both unique in design and small in file size. In Creating a Portfolio Web Site Using Flash CS4 Professional, Adobe Certified Instructor Paul Trani shows how to exploit Flash to create a web site that showcases work to clients and prospective employers. Find out how to add dynamic navigation, animation, and video to a page, and how to load, sort and display XML that enables portfolio content to be updated without opening Flash. This course is designed to take your existing tweening skills and gotoAndPlay code and walk away with a fully functional Flash site. Exercise files accompany the course.
One issue you might run into is how to add sound to buttons that are created with ActionScript and that's what's going on here with this portfolio, because I want to add just some click sounds when the user clicks on any one of these portfolio items. So that's what I want to do. I am going to close this SWF and I am going to go to the Timeline. So within this portfolio.fla, I need to open up that ActionScript layer, this very first frame.
I am going to go to Window>Actions. So here's where all my code is written and right down here when you click on any one of the images, it's going to fire off this function. This is where I need to add my audio, but I am going to start off at the very top. Right up here at the top, I am just going to do two forward slashes so I can add a comment and I am just going to type in SOUND. This is where my sound item is going to go. It's going to be a variable, so var clickSound is what I am going to make.
I'm telling Flash that it's a sound and here's where I create a new sound from the Sound class. All right. So here's where I create this variable called clickSound from this Sound class. But there's nothing in it yet. I actually need to do a URL request and I need to go out and grab that sound and then put it inside of this variable. So what I am going to do is I am going to go out to my desktop into my Assets folder. I am going to click on sound and this is the file that I want to play.
So I am going to copy this click.mp3 and I am going to move it into the folder that I am working in. So I am actually going to create a new folder just so I can keep everything organized and I am going to call this sound. And in this folder, that's where I am going to paste that click.mp3. So again, this is the portfolio.fla that I'm working in. So If I go back to it, for new sound what I need to do is I need to type in new URLRequest, an open parenthesis, open quote, sound, forward slash, click.
So it's in the sound folder, click.mp3 is what I am after. I need to close that quote and close that parenthesis, so make sure you have two down here at the end. But in essence, what's happening is it's taking and grabbing that mp3 and putting it right in this variable. So I am actually going to copy this variable, scroll down to where I want to use it, right inside of this function. So about Line 52 right now, I want to paste in that clickSound variable. All I need to do is type in a period and type Play and open and close parentheses. End it with a semicolon. All right.
So that's all I need to do, but let's go ahead and test this out. Now as I click on these buttons, you should hear a click sound. Great! It works like a charm, works great and what's happening is I've made this sound variable that grabs this click.mp3. So I do need to remember to make sure I always have this click.mp3 in this sound folder in relation to where the SWF file is.
So if I upload this site to a web server, I need to make sure this mp3 travels with it. But it's pretty easy to implement, took me two lines of code and works great.
Find answers to the most frequently asked questions about Creating a Portfolio Web Site Using Flash CS4 Professional.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.