Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Information on how to learn Flash is prevalent, but it can be frustrating to understand how to make an entire working web site using this unique technology. Here's a course that cuts through the clutter and offers practical tools for creating a dynamic web site, even for first-time developers. In Creating a First Web Site with Flash CS4 Professional, veteran Flash instructor Paul Trani simplifies the process of integrating animation, video, audio, and user interactivity to create a site that is dynamic and appealing. The goal of this hands-on workshop is to teach web site-building skills for today's demanding interactive industry. Exercise files accompany the course.
When you are using Flash you always want to think about what Flash is good at and use those features such as its ability to animate. And we do have some smooth animations between sections but when we get to our Portfolio section these images just load in like any other image. Not super sexy and that's what we want to do. We want to add some sexiness and really a 3D tween to bringing in these images.
So let me close that test file. Go to my Timeline. Let me double-click on this content movie clip and I'm going to scroll down to the Portfolio movie clip and double-click on it and that first layer is my ActionScript layer. If I select that first frame, I can then go open up my Actions panel. So here is all the code that's currently written and it's really making everything work and everything is looking great, but I want to add a tween to this.
So let me just hit Return a couple times to give myself some space. In fact, what I want to do is I want to listen for the completion of the load of this image. So this largeImageLoader is the loader component and I want to listen for the completion of any load. So let me just take this name and I'm going to right-click and copy it and I'll paste it just below, down here and I want to add an event listener to it.
I'm going to add an event listener. This listener is going to listen for an event and the event it's going to listen to is the COMPLETE event. There it is. It pops up in my code hint. I can hit Enter. It's going to listen for the complete of any image that's loading and once it does that, it's going to call the imageLoaded function. All right, function imageLoaded is what I need to code now. It's going to be an Event type. So it's not going to be a mouse event, just a regular event, and I'm going to had an open curly brace and a closing curly brace. Okay, so in this function, I'm going to have two lines of code. I'm going to have a trace that says image has been loaded, and then I'm going to another line of code.
But let's make sure this is working. All right, I'm going to go to Control > Test Movie. Portfolio section. Let me move down this Actions panel so we can take a look at our Output panel. When I click the next button, I should see images loaded and there it is. In fact, if I click it multiple times I'm going to see that printed out in my Output panel. So it is working and it's looking great.
Well, I want to add some cool tweens like I have with these other sections. I want to add a 3D tween. In fact, I'm going to use these tweens as an example or at least the starting point for my 3D tween. So I'm going to close my test file and what I want to do is I'm going to go out to Scene 1. And in Scene 1, if I go to my Timeline to that very first frame in the Actions/Labels layer, I can take a look at that code because I want to do the same thing. I want to add a very nice tween.
In fact, I'm just going to copy this tween format of moving the background. So I'm going to select it. I'm going to copy it and now I'm going to show you a nice shortcut because you have seen me bounce around and dig into different movie clips to access different ActionScript. When really what you have is you have all that available right here. You can see this is my navigator for ActionScript and it shows me everywhere where there is ActionScript and what I want to do is I want to go back into my Portfolio movie clip to the code there.
You can see this Code Navigator lets me jump right to that place as opposed to navigating through the Timeline like I was doing before. All right, I'm exactly where I want to be. In fact, I can close that just by hitting that arrow and open it as well that same way. But I'm going to nest that back on the side and I'm going to right-click and paste in the code I just copied. So what I want to do is I want to modify this tween call. I want to animate this largeImageLoader. In fact, I'll copy that name and replace the background and see with the instance largeImageLoader and instead of animating its X position, I'm going to type in rotationX. So it's going to rotate on an X-axis, flipping as if it was maybe something on a close line, forward and back is how it's going to work.
In fact, if I change Regular to Elastic, we'll get a nice bouncing effect there. And again, I want to replace this bkgd_mc with its starting point, which is going to be 90 degrees, and it's going to end up at 0 degrees. And if I ever need to remember what these different properties are, I can always come up here and show the code hint. So that's the finish point. So it's going to animate this from 90 degrees to 0 degrees. It's going to make it flat and it's going to do it over the course of two seconds.
All right, let's try this out. It should do it for every single image, each time one is loaded, it will call the trace statement and we'll animate it in. So let's go ahead and try this. Control > Test Movie. I'm getting an error and I know exactly what that is and I'm glad it came up because it's a call to a possibly undefined method tween. So this is an error you get if you use the tween class without importing the code that it uses.
So let me jump out and again, I'm going to use my Code Navigator to jump back to my main Timeline, that first frame. So that's the equivalent of going to the main Timeline clicking on that first frame and in here it says it's looking for this undefined method called Tween. And the reason it's asking for that is because that information is right here. So Flash is getting the code but it's only getting the code for everything on this current Timeline. So I need to copy this. Right-click, Copy.
Code Navigator, I'm going to jump back out into the Portfolio movie clip and right in here just above my function, I can right-click and paste in that code. Now because this is using the tween and this is using the easing. And I don't need this line but I'll keep it there. And I go to Control > Test Movie, click Portfolio. Now let's take a look at our tween and it swings in. A very nice look. It was one line of code, actually a total of three, but in general it's that one tween call that animates every single image swinging in, in a 3D fashion. Very nice, very sleek and very useful.
Find answers to the most frequently asked questions about Creating a First Web Site with 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.