Flash MX has an new capability that developers have been begging Macromedia for since they bought Flash; it can import an external JPEG file.

The way you do this is simple. Just use the a loadMovie command like you are planning to replace a movie clip with an external Flash movie. However, give the location of a JPEG file instead:

myMovieClip.loadMovie(”picture.jpg”);

The movie clip is now replaced by a movie clip that holds that bitmap image. Check out the movie 23loadjpeg.fla for an example.

Loading a Sound
There are also two ways to play a sound from an external file. They both use the sound object and the loadSound command. The sound file needs to be in the popular MP3 format.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

When using loadMovie, you can use the getBytesTotal and getBytesLoaded functions to check the progress of the load. This means that you can report the progress to the user with text or even a progress bar like the one used earlier in this hour.

If you want to preload a movie clip to have it ready before the user even gets to a place where it is needed, you can set up the external movie so that nothing is on the first frame but a stop() command. Then load the movie into a blank movie clip that is off the stage. When it completes, the movie just sits there on its blank first frame.

However, the movie file will be sitting in the user’s browser cache. Now when it comes time to really use the movie clip, do the loadMovie command again. The movie will be there quickly because the file has already been downloaded. Then issue a gotoAndPlay(2) command to get it past that first frame.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Check out the sample movie 23movie1.fla. When you test it, there are buttons that take you to one of two separate movies. Then the user can go back to the original movie. This is a good but simple example of how you can divide your presentation over several files rather than just one.

Loading a Movie Clip
The loadMovie command can also be used to load a movie into a movie clip. Instead of changing movies completely, you can just swap the content in a movie clip.

All you need to do is specify the movie clip that is to be replaced by the external file. For instance, to replace myMovieClip with the file othermovie.swf, just do this:

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

An alternative to streaming one large movie is to create a movie that isn’t full of media but loads that media from external files as it is needed. You can build a large presentation that is spread out over several files.

Replacing the Current Movie
The simplest way to do this is to divide the movie into several parts. When one movie ends, you can go to another. All you need to do is issue the loadMovie command.

For instance, you can have a frame at the end of a long animation where the movie stops. When the user is ready, he can click a button to go to the next animation, which is in another movie:

Or, you could give the user a choice. At the end of a movie there could be two buttons. The user chooses which animation to see next. In a situation where the user makes a choice like this, keeping content in separate movies is a great choice. After all, the user will probably never see the other content, so why require her to load it over the Internet?

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Place the exact same movie clip script on all 10 number keys. Do not place it on the asterisk or pound keys.

Test the movie. You should be able to click on any number key and see it light up. Click on it again and see it turn off. Test all 10 number keys. If it does not work, go back and double-check your work. Make sure that the right scripts are in the right places. You can use the example movie 08keypad.fla to see how this should work.

Place this script on the asterisk key:

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
_parent.clearAll();
}
}

Instead of sending the movie clip to frame 1 or 2, this script calls a function named clearAll that is one level up from this movie clip. One level up is the root level; we will have to make a function at the root level named clearAll. We’ll get to that in a minute.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Each movie clip instance must have a name. Name the 10 numbers one, two, three, and so on. Name the other two movie clips asterisk and pound.

Start with the movie clip at the upper-left corner. In Figure 8.1. It has the number 7 on top of it. It should be named seven. Place the following script on it:

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
if (this._currentFrame == 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
}

This is exactly the same script that we used in the previous example. It determines whether a mouse click took place with the mouse over this movie clip and sends it either to frame 2 or frame 1, depending on where it is now.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

In the example movie 08keypad-noscripts.fla, you’ll find all the movie clip instances in place but no scripts there yet. You will also see a layer that contains the 10 digits and the * and # characters. I placed these on top of the movie clips so that I didn’t have to build 12 different but similar movie clips. Instead, I could reuse the same movie clip and make it appear different by placing a different number on top of it.

Start with the movie 08keypad-noscripts.fla. Or, you can create your own movie with 12 instances of the same movie clip.

These movie clips should all have two frames. The first frame is the off state of the key. It looks like all the keys in Figure 8.1. The second frame is similar, but you can tell that the key is lit up, or somehow highlighted.

Place a stop(); command on frame 1 of the movie clip. This prevents it from animating when the movie starts. We want it to stay at frame 1 and wait.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

To change this into a selection script, we have to allow the user to click the movie clip multiple times and change the state of the movie clip from off to on and back to off again.

The script has to determine which state the movie clip is currently in and then send the clip to the other frame. The script can determine the current state by looking at the current frame of the movie clip. This can be done with the aptly named _currentFrame property. This property reads 1 when the movie clip is on the first frame and 2 when it is on the second.

Here is the new script. You can see it in 08twomcs3.fla. This is a complex script because it first tests the location of the mouse and then tests the current frame of the movie clip.

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
if (this._currentFrame == 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
}

Now you have seen two completely different ways of making selectable movie clips. I like the second way better because you don’t end up with the extra library symbols of the buttons. The advantage of using buttons, however, is that they can easily contain up, down, and over states, which are sometimes nice for user feedback as users make their choices.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Overweight can be a serious problem for women. But, there’s solution to get out from this problem. You need to swimming. Yes, swimming is the best activity that will give you both, exercise and relaxation.

But, you also need best womens swimwear that will look good on your oversize body. Therefore, Swimsuitsforall.com is here to help you. Yes, you can get best big size swimwear here. All of them are designed so you will look beautiful when you wear it.

You also can get plus size bathing suits here too. So, visit now and get the best product that you want. If you need more information, there’s a number here that you can call.

Comments No Comments »

This is because all movie clips get the mouseUp event sent to them. It is not exclusive to just the movie clip under the cursor.

Determining Which Movie Clip Was Clicked
There is a way to determine which movie clip has been clicked. The hitTest function tests a mouse location with a movie clip to see whether the location is inside the movie clip. So, by modifying the script, we can only send the correct movie clip to its second frame. You can see this one in example 08twomcs2.fla.

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.gotoAndStop(2);
}
}

The hitTest function can work a variety of different ways. In this case, it is fed the x and y values of the mouse location. It is prefaced with this so that it refers to the current movie clip. When the user clicks anywhere, the onClipEvent (mouseUp) handlers in all the movie clips get triggered. Then, both of the movie clips perform the hitTest test; only one that is under the mouse will test positive and jump to frame 2.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

  • Partner links