Creating a photo album with Adobe Flash 8 and ActionScript |
| Written by AnaS | |
|
In the first part of this tutorial you will learn how to create a photo album using Adobe Flash 8 and ActionScript. In the second part it will be described a possibility of adding transition between photos. Preliminars
Prepare 3 pictures with 360x285 dimensions. PicturesSelect the first frame in the pictures layer and choose File>>Import>> Import to Stage (or CTRL+R) and select the first picture you want for the album. Select the picture on the stage and in the Properties Inspector set X=0 and Y=0.In the same manner put the second and the third picture in frames 2 and 3 of the pictures layer. Now your stage should look similar with next picture: ButtonsNow we have to create the buttons for navigate through the album.Using the Rectangle Tool from the Tools panel draw a 46x46 square with X=25 and Y=290, in the first frame of buttons layer. Using the Text tool type 1 centered in the square. Now select both the square and the text right-click and choose Convert to Symbol (or press F8). In the Convert to Symbol box choose Button and give the name Button1. Select the button with the Selection Tool and in the Properties panel give it the instance name button1_btn. In the same manner create a Button2 and Button3, and the corresponding instances button2_btn and button3_btn. How to customize your buttons in Flash is the subject of another tutorial. We will go further and write the code for the photo-album. The ActionScript codeIn the buttons layer insert 2 more frames (F5).Select the first frame of the actions layer. Press F9 and in the Actions panel start to write the following code.
stop(); Now go to Control >> Test Movie (or CTRL+Enter) and the result. Transitions between photosGo to the first frame of the pictures layer, select the image and press F8. From the Convert to Symbol box select Movie Clip, write the name Picture1MC and click OK.Double click the movie you have just created, select the picture inside using the Selection Tool (V) and go to Insert>>Timeline Effects>> Transform/Transition>>Transition. Click Ok in the box appered. Insert a new layer and name it actions. Insert a new keyframe (F6) in the position 30Actions panel and press F9 to open the . Write here stop(); code and then go to the main stage. Follow the same steps for the picture 2 and 3. Test the movie again Control >> Test Movie (or CTRL+Enter) and see the result: You need to Register in order to download the FLA file.
written by liam , September 20, 2007
it works, but wouldnt it make more sence to use variables rather than with all that extra code?
written by Miles , October 02, 2007
I was getting a syntax error in using the following code from this tutorial. Any help would be mucho appreciated. **Error** Scene=Scene 1, layer=actions, frame=1:Line 1: Syntax error. stop();button1_btn.onPress=function(){_root.gotoAndStop(1);}button2_btn.onPress=function(){ _root.gotoAndStop(2);}button3_btn.onPress=function(){ _root.gotoAndStop(3);}button4_btn.onPress=function(){ _root.gotoAndStop(4);}button5_btn.onPress=function(){ _root.gotoAndStop(5);}button6_btn.onPress=function(){ _root.gotoAndStop(6);}button7_btn.onPress=function(){ _root.gotoAndStop(7);}button8_btn.onPress=function(){ _root.gotoAndStop(8);}button9_btn.onPress=function(){ _root.gotoAndStop(9);}button10_btn.onPress=function(){ _root.gotoAndStop(10);}button11_btn.onPress=function(){ _root.gotoAndStop(12);}button12_btn.onPress=function(){ _root.gotoAndStop(13);}button13_btn.onPress=function(){ _root.gotoAndStop(14);}button14_btn.onPress=function(){ _root.gotoAndStop(15);}button15_btn.onPress=function(){ _root.gotoAndStop(16);}button16_btn.onPress=function(){ _root.gotoAndStop(17);}button17_btn.onPress=function(){ _root.gotoAndStop(18);}button18_btn.onPress=function(){ _root.gotoAndStop(19);}button19_btn.onPress=function(){ _root.gotoAndStop(20);}button20_btn.onPress=function(){ _root.gotoAndStop(21);}button21_btn.onPress=function(){ _root.gotoAndStop(22);}button22_btn.onPress=function(){ _root.gotoAndStop(23);} Total ActionScript Errors: 1 Reported Errors: 1 Cheers!!!
written by v , October 23, 2007
where it says 'Select the first frame of the actions layer. Press F9 and in the Actions panel start to write the following code. ' there aint no code following?!
written by anonymous , December 17, 2007
Use actionscript 2 for starters.
written by dark , March 02, 2008
stop();//fixed code remember to use the same syntax button1_btn.onPress=function(){ _root.gotoAndStop(1);} button2_btn.onPress=function(){ _root.gotoAndStop(2);} button3_btn.onPress=function(){ _root.gotoAndStop(3);} button4_btn.onPress=function(){ _root.gotoAndStop(4);} button5_btn.onPress=function(){ _root.gotoAndStop(5);} button6_btn.onPress=function(){ _root.gotoAndStop(6);} button7_btn.onPress=function(){ _root.gotoAndStop(7);} button8_btn.onPress=function(){ _root.gotoAndStop(8);} button9_btn.onPress=function(){ _root.gotoAndStop(9);} button10_btn.onPress=function(){ _root.gotoAndStop(10);} button11_btn.onPress=function(){ _root.gotoAndStop(12);} button12_btn.onPress=function(){ _root.gotoAndStop(13);} button13_btn.onPress=function(){ _root.gotoAndStop(14);} button14_btn.onPress=function(){ _root.gotoAndStop(15);} button15_btn.onPress=function(){ _root.gotoAndStop(16);} button16_btn.onPress=function(){ _root.gotoAndStop(17);} button17_btn.onPress=function(){ _root.gotoAndStop(18);} button18_btn.onPress=function(){ _root.gotoAndStop(19);} button19_btn.onPress=function(){ _root.gotoAndStop(20);} button20_btn.onPress=function(){ _root.gotoAndStop(21);} button21_btn.onPress=function(){ _root.gotoAndStop(22);} button22_btn.onPress=function(){ _root.gotoAndStop(23);} button23_btn.onPress=function(){ _root.gotoAndStop(24);} //^ Fixed code
written by raneesh , April 19, 2008
its very good tutorials
written by raneesh , April 19, 2008
i want study flash action script Do you need more help? Ask now!
|
|
| Last Updated ( Saturday, 22 March 2008 ) |