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.
Flash does many things really well, but probably at the top of the list is its ability to animate, which is what I want to do with this site. I want to create some smooth transitions from one section to the next. Because currently what happens is if I click on a section, it's just a straight cut from where this navigation was, to the About section, and really I want it to animate. And what's great about Flash is I can build some Tweens, so it does all the in between frames. I don't have to move something frame by frame. I can just tell Flash, "Move it from point A to point B." And that's what I want to do, going from section to section, move it from point A to point B, just build out the Tween.
So let's take a look at what I currently have, because in the Timeline I have my AS layer. I can select that first frame. And what I want to do is go to Window and open up the Actions panel. And if I scroll down, I see that I have all of my EventListeners that listen for a Click and then fire off this homeClick function, and then it just pops directly to this position, for instance, and rotates it as well.
So I want to really, ultimately replace these with some nice Tweens. So I am just going to move to the very top and just hit Return a couple of times, become I want to do a Tween, and I will just type in Tween. So this is the keyword you need to remember. It's a keyword in Flash, and you can select it, do a right-click, and then View the Help for Tween. Here is Flash's Help on the Tween class. It tells me what it does. Well, it lets you use ActionScript to move, resize, and fade movie clips by specifying a property of the target movie clip and then animate it over a number of frames or seconds.
So here's the code. I love it that they have given me some code as an example, but this is the code I need. There's some further notes in here, saying that there's some parameters that I need to modify. So I am going to just take this code, right- click, copy it, and then go back into Flash. Right here at the top, I am going to go ahead and paste this code. And now let me just explain what's going on, because these first two lines, these are import statements.
In general, this just TELLS FLASH TO IMPORT THE APPROPRIATE CODE to make this Tween work. So these two line tells Flash to import the appropriate code, and here is the Tween. So what this does is there is a variable called myTween, and what I want to do is I want to move the content movie clip when that button is selected. So the first thing I need to do is just cut this and move it to the correct spot.
So let's start with the about button. Inside of this aboutClick function, instead of it just popping directly to the x position, I want to add the Tween, so I am going to paste this Tween right in here. All right. I am just going to go ahead and type in 'Animate,' because that's what this is going to do. I want to animate the xTween, so I am going to change this variable to myxTween. And I need to define the Object to move content_mc.
I am going to change the x position. It's going to do this with elasticity, so it's going to be kind of like a rubber band. I can control this as well. And then I am given some numbers down here. And if you are ever curious as to what a parameter is, you can always put your cursor in there and then select Show code hint, and then that will tell you. Well, this is the begin point. Where do I want it to start from? I don't have an exact number I want to put in here, but wherever the content_mc is, wherever its x position is is where I want it to start.
So I am doing content_mc.x. And where I want it to end up is this point right here, -250. So I can take this, Command+C, copy it, paste it right in here. And this is going to happen. What is this last number? Well it's the duration. It's going to happen over the course of seconds, because this true means use seconds. Or I can say, "You now what? Animate it over the course of one second." All right.
There's myxTween variable, and I can go ahead and just Delete that property to change the position of the x, because now that I have this Tween, it's going to do all the work for me. So Control > Test Movie. I have just changed one property for the About section, so only one thing is going to move. If I click on it, did you see that bounce? Click on it again. It does that crazy bounce. I can do it multiple times, and I really only have one property that's being animated.
So let me just expand this out a little more so I can see this long line, but I want to do the same thing for these other two properties. So it's just a matter of copying this, Command+C, Command+V and changing what you need to change. So I am going to change the yTween, move the content movie clip, its why position, from wherever it currently is to this point right here. So again, I want to Command+C to copy that, Command+V, put that right in there, over the course of 1 second. All right.
Let's Copy this one again and let's do the rotation. myrotate, rotate the content_mc, rotation. Its current rotation position to -90 over the course of 1 second. Now that those are written, I can Delete that, and you did see the Elastic. You saw how it worked like a rubber band. Well, I am not particularly fond of that effect. I will just change this to Regular.
It's going to be a Regular easing, so it's going to be really smooth. And what easeOut means is when it reaches its resting point, it's going to slow down gradually. All right. It's looking pretty good. Now I am going to go ahead and Test my Movie, click on the About section, and that animates into place. Beautiful! Let's try it again, see it move into place. So I want to do the same thing for all the others, so I need to do this three more times.
So let's expand out this panel some more. So what I want to do is I want to copy all this code, Command+C, for the Home button inside of this function, so just before that closing curly brace, I just want to start replacing those numbers. So Command+C, or Ctrl+C if you are on a PC. I can start replacing these numbers, just like that. And don't forget to remove those first three lines, so we just have our Tweens in there, and that's looking pretty good. All right.
Let's Copy this again. For the video button, make sure you get the minus, or the negative, 920 x position, y position, and then the rotation is just going to be 0. And lastly, this Portfolio section -1000, 1450, and -90, just like that.
And remember, if you forget what these numbers are, just put your cursor in there and then click Show code hint and it will tell you, "Oh, this is the finished position." So keep that in mind. I will Delete these three lines. Everything is looking pretty good. In fact, I can go ahead and check syntax. It says the script contains no errors. That's great, but is everything going to line up and animate to the correct position? Well, let's check it out and see. Control > Test Movie. Click the About section, works great.
My Home button, it animates back into place, my Video button does a pop, which I need to fix, and then I have my Portfolio section, which animates up. So there is some weirdness that goes on. In fact, it looks like I still need to do -- aha, this is what you might run into, is that it pops directly there, and it's because I did not remove this code. So I just need to Delete that and then everything should be fine. So for the most part, everything is looking pretty good.
Control > Test Movie. And looks like I need to fix a couple of things, because this 'o' is getting cut off, and I want to point this out, because if you don't have items positioned on whole pixels, on whole numbers, then you might get this weird sort of cutting effect. So I want to go back in and make sure the position, the initial position of my content_mc is on a whole number, and that will alleviate this sort of cut right here, but I am really getting into the point where I am fine tuning this.
If I click on About, yeah, it rotates into place. This 'o' is getting cut off right there, so I might need to move its y position down some, so it fits in there fully. In fact, if I click on Portfolio, that looks a little more appropriate. Maybe I can scoot it over a little bit, and then if I click back here on the Home button, it navigates back into place. And as you can see, it navigates back into the center position, and it is on whole pixels, so that's why you don't see that being cut off.
So be aware of that. And what I am going to do is I am going to fix those two things: the About section, where it's sitting a little high, and then this Video, how that gets cut off a little bit. And I am going to minimize that Actions panel. I am going to select this content_mc, and if I look in the Properties panel, Position and Size, -599.15. Well, you know what? Let's just round that up to 600. In fact, this y position, 751.95. Let's just make it 750. We will start to get things sort of lined up just right, and that's kind of what happens even if you start to sort of scroll things back and forth, they get a little funky, but feel free to just type in exactly what you need.
And if I zoom in, Command+Plus, you can definitely see that everything is okay, so it's that positioning that's getting things a little weird. All right. Let's go back into the Timeline panel. I am going to select that first frame in the Actions layer, and I am going to look at the About button, and its y position, it was sitting a little high, so it's 1430. So to move it down I need to add to this number, so I might want to make that 1450. In fact, I can even compare that with the Portfolio section, because the Portfolio section is on the same y position, and that does say 1450.
So it's much more appropriate now, and I am going to go ahead and do a Test Movie, see the Video isn't getting cut off, that I can see the About section is in a better position, the same as the Portfolio section. And everything is positioned appropriately. I can even scoot this in a touch if I want to. But this really allows you to give you a sort of full control over the positioning of items, as well as just the animating of them, which just really adds just another dimension to your website.
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.