You are browsing the archive for Actionscript 2 Tutorials.

How to Make A Preloader In Flash (AS2)

December 25, 2009 in Actionscript 2 Tutorials

Introduction

A useful tutorial for those who are still in the process of learning Actionscript 2, or maybe they know Actionscript 2 but are not sure how to create a preloader. No problem either way or another because we have your back. We’re going to show you how to create a preloader using the power of Flash’s awesome language Actionscript; in this case, Actionscript 2.

What is a preloader? What’s the purpose for one?

A preloader shows you the amount of data downloaded before continuing with a Flash module. You’ll find these in Flash games and Flash toons. Many programmers like to make their preloaders in a bar type format; a case when a bar fills a stroke every time it loads data, showing you how long the video or game will be finished. The bar preloader is the style I’ll be showing you; it’s more modern.

If preloaders are shown in games and movies, why not YouTube and other sites?

YouTube and other video sharing sites do have preloaders but not how you think it is. You see, YouTube and most of the video sharing sites do something called stream. They stream their videos meaning the video is playing and downloading in the background at the same time. Do you really want to wait for a 3GB video download first and then play? As I said previously, their preloaders show when the video is playing and reaches a limit where the video is not yet downloaded; it will stall, preload the video, and then continue streaming.

Video Tutorial

Here’s another video that I made. Watch carefully to where you import this script.

Actionscript (WATCH VIDEO FIRST)

Here’s the Actionscript for the preloader. Be sure to watch the video to understand where you import this script (I said that already, sorry.)

//########################################################
// PRELOADER SOURCE CODE - CODE BY FlashWizard@funtut.com
//########################################################

// stop the video to allow the preloader to do it's work.
stop();

// your made progress bar default width will be set to 0
var pc  = 0;

// setting function
this.onEnterFrame = function(){

	// everytime bytes are loaded, your made progress bar will add on a pixel from 0 to your desired width
	pc = Math.floor((_root.getBytesLoaded() /_root.getBytesTotal()) *100);

	// bar will animate the loading process from left to right
	this.bar._xscale = pc;

	// when preloader is complete showing the download progress
	if (pc == 100 && !isNAN(pc)){

	// stop the process
	delete this.onEnterFrame;

	// and continue playing
	_root.play()

	}

}

That’s about it. The preloader should be finished. Hoped you liked this tutorial. Please rate and leave a comment :)

How to Make A Platform Game In Flash

December 24, 2009 in Actionscript 2 Tutorials

Summary

Hello everyone and welcome to Funtut. Here is a great lesson to those who love exploring a program that Adobe has created called Adobe Flash. They made several versions of Adobe Flash and so far they made it to the CS5 suite. Adobe Flash is used for making Flash videos, advertisements, and Flash is mostly popular for making Flash games. You know, those little / short games that you play online. But of course there are some Flash games made from a program called Adobe Shockwave which is used for making 3D games or 2D games. So if you are one of those people who love messing around with Flash, then I know you’ll like this tutorial. The lesson will be learning how to make a platform game in Flash.

Resources

Free online sprites (Mario sprites, Zelda sprites, Sonic sprites and more.)

Step by Step Lesson

Okay the first thing that you would want to do is open up your program Adobe Flash and open up a new document selecting Actionscript 2.0 version. Actionscript 2.0 is the second Actionscript version that Adobe created for Flash. The easiest version to learn is 1.0 of course because it has less coding.

After creating a new document with the version of Actionscript 2.0, make your character with his running sprite, jumping sprite, and dunking sprite. What is a sprite? A sprite is animation of movement. For example: a character walking repeatedly is a sprite. The sprite has to be compressed in a movieclip such as: The walking sprite is one movieclip and the jumping sprite is another movieclip. To create a movieclip, press F8 on your keyboard -> name your movieclip -> select movieclip -> select middle registration -> and click OK.

You have successfully created your sprite made movieclips. After your done creating them, please make a new movieclip that contains all of the movieclip sprites. We’ll be naming this main movieclip “Character.” Now edit the movieclip by double-clicking the name of the main movieclip (Character) located in the library. The library is found on the right sidebar of the Adobe Flash program. The library contains all the graphic symbols, movieclip symbols, and button symbols. Now you should be in the “Character” edit mode. Drag the standing sprite in the first keyframe, drag the walking sprite in the second keyframe, and then you drag the ducking sprite in the third keyframe.

 

ChatClick here to chat!+