[Flash] Loading

xiaoxiao2021-03-06  56

All of the world's Loading can probably be divided into three parts: 1 Manufacturing a loop for updating data. Generally speaking, there are two methods, one is to make two frames, generate a loop in the second frame. The other is to do only one frame, use the onenterframe command to generate a loop. 2 Using GetBytestotal () to obtain file data with the getBytesLoaded () command. 3 Explain the data acquired by the second step in a graphic or animated manner (generally also explicitly expressed in text)

The following code is the source code for the onENTERFRAME command: =========================================== ========= ========= p (); _root. CreateTextField ( "MYLOAD_TXT", 1, 0, 0, 0, 0); with (_root. myload_txt) {// set text background = true; // text boxes have background backgroundColor = 0x336699; // text box background color TextColor = 0xffffff; // Text field color type = "Dynamic" // text field is dynamic text selectable = false; // Text is optional option = "center"; // Control text field automatic size adjustment and alignment _x = Stage.width / 2; // The horizontal of the text field _y = stage.Height / 2; // Text field ordinate} Onenterframe = function () {var loaded = _root. GetBytesLoaded (); var total = _root. GetTestotal (); _root. myload_txt. text = math. floor (loaded / total * 100) "%"; if (loaded == Total) {OnenterFrame = null; removemovieClip (_root. myload_txt); play (); }}; ===========================================

转载请注明原文地址:https://www.9cbs.com/read-116685.html

New Post(0)