Search Tutorials
ActionscriptActionscipt can seem really daunting to some, so I will try to make it as easy as possible. It greatly helps if you know dot syntax, but you won't suffer if you don't. Actionscipt is always easier to find and work with, etc when its on it's own layer.
Create a new layer on the main timeline, and call it "Actions". The layer should be blank. Create three keyframes in it. Now on the first layer with all your content on it, select frame 3 and press F5. On the actions layer, we will detect the total size of the flash movie, and detect the total amount of it that is loaded. We will then get a percent from these two values, then control what the textbox says, and what the bar does. You will notice i use _root.a lot. That is so that all these variables are placed for sure at the base of the movie. In the first frame of the actions layer, add these actions: _root.bytesLoaded = _root.getBytesLoaded(); _root.bytesTotal = _root.getBytesTotal(); _root.percentLoaded = Math.round(100*(_root.bytesLoaded/_root.bytesTotal)); _root.percentLoadedText = _root.percentLoaded+"%"; _root.bar.gotoAndStop(percentLoaded); I will explain this code on the next page, but for now just add the actions. Now in frame 2 of the "Actions" layer, as this code: if (_root.percentLoaded==100){
gotoAndPlay(3);
}else{
gotoAndPlay(1);
}This checks to see if its all loaded, if it is go to the third frame, or your intro animation. If not, go back and refresh yourself on the new amount loaded. You are now finished your preloader - well, mostly anyways. For details on how this works, and things you may wish to do, continue reading.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|