Saturday, September 10, 2011

Simple Flash Preloader using ActionScript


  1.  Create 2 layers called actions and preloader. The actions layer will contain the action script and the preloader layer will contain the preloader.




  1. In the first frame of the preloaderlayer. Select the rectangle tool and set the stroke color to black and fill color to a lighter shade and draw a rectangle as shown below.


  1. Selecting both the stroke and fill of the rectangle press the F8 key to convert it to a symbol. In the name textbox, name the movie clip as preloader_mc and set the registration points totop-left corner and click OK to convert it to a movie clip.




  1. Click the preloader_mc movie clip and in the properties panel, give it the instance name preloader.





  1. Double click on the preloader_mc movie clip to go inside the movie clip. Once you are inside, click on only the fill area to select it and press the F8 key to convert it to a symbol. In the name text box, name the movie clip asloadBar and set the registration points to top-left corner and click OK to convert it to a movie clip.





  1. Click the loadBar movie clip to select it and in the properties panel, give it the instance name loadBar.





  1. Create a new layer called picture to display a picture after the preloader completes loading.





  1. Insert a blank keyframe in the second frame of the picture layer and import a picture to the stage.





  1. Select the first frame of the actions layer and enter the following lines of code
stop();
preloader.onEnterFrame = function()
{
            filesize = _root.getBytesTotal();
            loaded = _root.getBytesLoaded();
            preloader._visible = true;
            if (loaded != filesize)
            {
                        preloader.loadBar._xscale = 100*loaded/filesize;
            }
            else
            {
                        preloader._visible = false;
                        gotoAndStop(2);
            }
};
  1. Test the movie by pressing Ctrl+Enter 2 times to simulate download or else the preloader would not be visible as you are directly loading it from the hard disk.
Source:

Networking

IP Addressing So what’s a TCP/IP Address? TCP/IP address works on the Network and Transport layer of the OSI-ISO reference model and Intern...