Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Adding functionality to thumbnails

From: Creating a Portfolio Web Site Using Flash CS4 Professional

Video: Adding functionality to thumbnails

Once you have your buttons in place, you can begin to work on what happens when these buttons are selected, or when these thumbnails are select. So when you click on a Cafe buena thumbnail, I want to load that image into this large area, and then replace the text to down here. So I am going to jump into my portfolio.fla, and I am going to select that ActionScript, that first frame there, and I am going to go to Window and open up my Actions panel, and I am going to pin my code by pressing that button there.

Adding functionality to thumbnails

Once you have your buttons in place, you can begin to work on what happens when these buttons are selected, or when these thumbnails are select. So when you click on a Cafe buena thumbnail, I want to load that image into this large area, and then replace the text to down here. So I am going to jump into my portfolio.fla, and I am going to select that ActionScript, that first frame there, and I am going to go to Window and open up my Actions panel, and I am going to pin my code by pressing that button there.

So here I have my code, which loads in that Thumbnail image for the basketball.jpg and the cafebuena.jpg. What I need to do is add another EventListener in here and I need to add an EventListener that listens for the click, But I need to do that once this thumbnail loader is created. So I actually need to make it right inside of this thumbloaded function.

So right in here, I'll just hit Return a couple of times, just before that closing curly brace, I need to add an EventListener. So thumbLoader.addEventListener. If it highlights for you, you can hit Enter and it will add it, keep you from typing that whole word there. You can type in MouseEvent, because I am going to listen for MouseEvent, specifically the CLICK method.

So when it's clicked on, it's going to fire off this function called LoadMainImage. There is my function call for LoadMainImage. Now I need to create that function, LoadMainImage and I am going to be loading this image multiple times. So I am going to need to do the same thing down here, so what I think I am going to call this is LoadMainImage1, because there is going to be multiple functions.

So, LoadMainImage1 event colon, MouseEvent is what it's expecting. So I need to make sure these two words match up, and this function is going to be void. Just so you know what void means, sometimes you'll have say an add function that passes out may be two numbers that were added together, so it might pass back out that number. Void means it's not going to pass any content, or any text, or any code outside of the function.

It's all just kind of happen inside of it. Open curly brace, close curly brace and within this LoadMainImage1, this is where I want to add code, just to do what I want it to, when this button is clicked. So I need to reference this large UILoader component. It's pretty large, so in my PROPERTIES panel, what I'll call it is largeUILoader. I just need to remember this instance name. In fact, I'll do a Command+C to copy it.

I am going to go back into my code, and paste largeUILoader that instance name. I am going to change its source= portfolio/large/basketball.jpg, just like that, semicolon at the end. Now I can go ahead and use this EventListener for thumbLoader2, so I am going to copy these four lines, the EventListener and also the function.

I am going to paste it down inside of this thumbLoaded2. So addEventListener, Mouse Click. It's going to give me an error if I don't change this function here, because I want to have a LoadMainImage2 function. So this is the call to this function, so I need to change it here as well. Then I want to load in a different image when this button is selected, and this is the cafebuena.jpg image, just like that.

Notice as you start to nest functions within functions, things get a little crazy. In fact, you could have things indented more than once, and it's not a big deal to have multiple spaces before or after Lines, but what you can always do is click this Auto Format button, right next to Check syntax button. If I click that button, it's going to line everything up accordingly. So everything looks cleaned up, it kind of formats everything nice and neat, and just makes it little easier to read, so now I know what's inside of this function, for instance.

I am going to go ahead and test this movie. All right. Everything looks as expected, but let me come down here and click on Cafe buena, and I don't get anything, but I do get a Flash for this. So I am going to take a look at that Cafe buena, and right in here, since it didn't throw an error and it wasn't working, well I need to check the instance name, so I need to change that to thumbLoader2. Now I am going to do a Control > Test Movie. If I click the cafe buena, it changes, so be aware of your instance names. If I click back, that changes as well.

First thing I noticed is I don't have the little hand cursor. Quite frankly, I need to use that hand cursor. I need to have this movie clip work like a button, so I need to activate that hand. So what I am going to do is create a new line, and for the allThumbnails, I'm going to change this movie clip. It's buttonmode=true. So now it's going to work like a button.

It's going to give me the hand that I need, so I know that those thumbnails are clickable. I can take this and I can copy it and use it wherever I want, for any movie clip, but I am just going to go ahead and test this movie. As I roll over either one of these, I can see that I get the hand and now users know that these are clickable, and it will load in the correct information. All right. Now what I need to do next is I need to change this content down here as well. So right now this is just a Static Text. I need to change that, so I am going to select this text field and then in the PROPERTIES panel, I want to change this from Static Text to Dynamic Text.

So Dynamic Text means it's going to change at some point in time, and when I select that, I get the opportunity to give it an instance name. So I'm just going to call it something simple like selectedTitle, because that's going to be whatever was selected is going to appear right in there. And then for this text field right here, I am going to change that to Dynamic Text, and I am going to change this to selectedDescription, so that's going to be a description.

I am going to minimize that LIBRARY panel, and just to show you what also you need to do, because down in here for the various PARAGRAPH options what I need to do is I need to change the Behavior. Instead of it being Single Line, I might need this to be MultiLine. So if you have a lot of text, I need to make sure it wraps to the next line. I'll even expand that out more, but notice you also have the ability to make the text Selectable. If you want you can turn that on or off, or you can even Render text as HTML.

Because I could have HTML text in here, so I can make a word bold if I want to. But in general, that's looking pretty good, and notice what it does visually. It gives me these dotted lines for these text fields, an indication that they are Dynamic Text fields. But I needed to keep in mind selected title and selected disk are the instance names, and for this first image I can go ahead and when that image is selected, go ahead and change the selectedTitle, its text property=whatever I want that text to be, and I'll just type in Basketball.

And for the selected Description, change its text property to Basketballdescription, whatever you want that to be. So for the sake of time, I'll just do that. I want to do the exact same thing for the other buttons, so I am going to Copy these two lines and paste them right in here. Of course, I am going to change the text to Cafe - There we are, something like that. Keep it simple, and we are looking pretty good.

So again, I might want to click Auto format and Check syntax tells me everything looks good, and then I'll click Test Movie, so I can change these default values right in here. But notice that when I click on Cafe buena. it changes those two text fields, It also changes it back to say whatever the Basketball description is. It works both ways. So, sure enough, the site is set up and it's ready to go. I can add multiple thumbnails if I want to, and they'll all follow the same format.

But it's really just a matter of adding an additional EventListener that listens for a CLICK that then changes various properties of elements that already exist on your stage.

Show transcript

This video is part of

Image for Creating a Portfolio Web Site Using Flash CS4 Professional
 
Expand all | Collapse all
  1. 1m 41s
    1. Welcome
      1m 7s
    2. Using the exercise files
      34s
  2. 24m 1s
    1. Understanding web design
      2m 44s
    2. Creating a Flash file
      3m 18s
    3. Importing a design from Photoshop
      7m 45s
    4. Optimizing the design
      10m 14s
  3. 13m 59s
    1. Dynamically loading an image
      3m 37s
    2. Loading random images
      10m 22s
  4. 47m 38s
    1. Creating menu buttons
      8m 18s
    2. Adding functionality to buttons
      8m 56s
    3. Adding navigation
      9m 45s
    4. Creating transitions
      12m 0s
    5. Simplifying code
      8m 39s
  5. 26m 11s
    1. Creating web site sections
      7m 41s
    2. Dynamically loading sections
      11m 7s
    3. Linking to web sites and email addresses
      7m 23s
  6. 29m 18s
    1. Setting up a portfolio
      12m 31s
    2. Adding functionality to thumbnails
      10m 10s
    3. Allowing for unlimited thumbnails
      6m 37s
  7. 41m 17s
    1. Benefits of using XML
      4m 42s
    2. Loading XML content
      4m 34s
    3. Sorting XML content
      7m 32s
    4. Displaying XML content
      7m 35s
    5. Using XML to create thumbnails
      8m 41s
    6. Displaying content with thumbnails
      8m 13s
  8. 25m 59s
    1. Creating and importing video
      9m 47s
    2. Adding a Full Screen button
      4m 15s
    3. Creating custom video controls
      4m 50s
    4. Adding functionality to video thumbnails
      7m 7s
  9. 9m 12s
    1. Adding audio to buttons
      5m 30s
    2. Adding audio to dynamically created buttons
      3m 42s
  10. 21m 19s
    1. Applying professional transitions
      9m 26s
    2. Creating a preloader
      8m 56s
    3. Publishing a web site
      2m 57s
  11. 3m 15s
    1. Reviewing the "corporate" Flash site
      1m 40s
    2. Reviewing the "artistic" Flash site
      1m 35s
  12. 12s
    1. Goodbye
      12s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating a Portfolio Web Site Using Flash CS4 Professional.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.