Search Tutorials
Part 1 - Setting up the Main Flash MovieThe main Flash movie (Ecards.fla) is your base of operations. This file allows the user to select the e-card they want to send, then allows them to enter custom text which will be sent along with the e-card when they send it to a friend or anyone else they want to. By opening up the Flash Fla file and going over it first you will have a much better understanding of the part that I'm going to go over next. This part of the tutorial is not really necessary if you already have a good working knowledge of Flash 5. The fla file contains a movie clip named 'ECards'. This movie clip has
5 frames, each frame contains an image of the Ecard you want to send out. This movie clip is used 5 times (1 time for each
e-card that you want to allow
users to select from). Their are 5 different instances of the movie clip 'ECards',
each instance is used to display a different frame of the movie clip - which
corresponds to a different image of an e-card. The first image to the right demonstrates this point. This is the first instance of the movie clip 'ECards', their are 5 other instances with instance names of Ecard2, Ecard3, Ecard4, Ecard5, etc. You should be able to easily change this part or add new ones to the list.
In the first frame of the layer 'Actions' their are a couple of lines of actionscript which tell each e-card what frame to display. For example Ecard4 is told to gotoAndStop at frame 4. On frame 4 of their is a preview image of Ecard 4. These commands are shown in the second image to the left. They can also be found in the fla file.
Over each Movie Clip their is a button. This button allows users to select which card they want to send by clicking on it. The buttons contain the following actionscript. on (release) {
gotoAndStop (2);
EcardSelect = "1";
}
This tells the main movie to gotoAndStop at frame 2. And also sets the variable EcardSelect equal to 1. The actionscript on the button over the second e-card would be exactly the same except the variable EcardSelect would be set equal to 2. The EcardSelect variable will be used throughout. This brings us to Frame 2 of the main Ecard Movie. This frame contains the actionscript that sets up the preview image of the card that was chosen and also the actionscript that checks the custom text fields and post's that information to the PHP script that sends the card. In the second frame of the layer 'Actions' their is a line of actionscript as follows: _root.EcardPreview.gotoAndStop(EcardSelect); The 'ECards' Movie clip is again used, only this time it is given an instance name of 'EcardPreview'. This line of actionscript tells this instance of ECards to go to and stop at the frame that corresponds to the variable EcardSelect - that was set when the user clicked on a specific E-card. Their are a number of text fields in this frame. They are all input text fields. Make sure that you do not have the 'html' checkbox checked off for these text boxes.
The last part of setting up the main 'Ecards.fla' file includes sending the custom information to a script which then processes that information. On the 'Click here to send e-card' button you will find the following text: on (release) {
if (ToName eq "") {
_root.Status = "Please enter the Name of the person your sending this to";
} else if (FromName eq "") {
_root.Status = "Please enter your Name";
} else if (ToEmail eq "") {
_root.Status = "Please enter the Email address your sending this to";
} else if (FromEmail eq "") {
_root.Status = "Please enter your email address";
} else if (Greeting eq "") {
_root.Status = "Please enter a greeting message";
} else if (IntroMessage eq "") {
_root.Status = "Please enter a Intro Message";
} else {
gotoAndStop (3);
_root.Status = "Sending Ecard - Please Hold";
loadVariablesNum ("SendEcard.php", 0, "POST");
}
}
The first couple if-else statements just check to make sure that the user filled all the fields out. Then if they did it tells the main movie to go to and stop at the 3rd frame of the movie - where the user will see a success 'the message has been sent' notification. Also the loadVariablesNum command post's all of the variables in the movie to a script which later processes the results.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|