Hi Cyberfem. Peops!
I’ve compiled all the Actionscript we’ve learned–and just a few more bits o’ code–in a handout. CLICK HERE to download!
Attach the following code to a jd_button. Remember to save all content–.swfs, .jpgs, etc–to a folder along with the .fla file. Again, we’ll designate a path and add the last line of code when we upload to the interwebs!
on (keyPress “<Space>”){
filename = ["background1.jpg", "background2.jpg", "background3.jpg", "background4.jpg", "background5.jpg", "hypertext1.swf"];
path = “”;
i = filename.length;
k = [...]
Attach the following code to a jd_button or regular button. Remember to save all content–.swfs, .jpgs, etc–to a folder along with the .fla file. Again, we’ll designate a path and add the last line of code when we upload to the interwebs!
on(release){
filename = ["background1.jpg", "background2.jpg", "background3.jpg", "background4.jpg", "background5.jpg"];
path = “”;
i = filename.length;
k = [...]
This code randomly ‘calls up’ an image or other content and loads it into a frame. REMEMBER to include external content to a folder with your .fla file.
Attach the following actionscript to the first frame of a layer (NOT the actions layer):
filename = ["background1.jpg", "background2.jpg", "background3.jpg", "background4.jpg", "background5.jpg"];
path = “”;
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(filename[k], [...]
Import an mp3 or a .wav file into your library. “Export your sound file to Actionscript”–>control click on your sound file, click on “Linkage”, select “Export to Actionscript”, and give your sound file an identifying name (that you’ll remember!). Then:
Click on your button…Windows>Behaviors>Add (plus sign)>Sound from Library>use the name you typed in as [...]
To ‘unload’ a movie that you’ve called up using the loadMovie function, you can simply load a ‘blank’ movie clip:
on(release){
createEmptyMovieClip (”firstMovie”, 23);
firstMovie.loadMovie (””);
firstMovie._x=125;
firstMovie._y=200;
}
Attach this code to a jd_btn or regular button to ‘call up’ external content–.swfs, .jpgs, .movs. REMEMBER, your content must exist in a folder along with your .fla file:
on(release){
createEmptyMovieClip (”firstMovie”, 20);
firstMovie.loadMovie (”image1.jpg”);
firstMovie._x=125;
firstMovie._y=200;
}