STORY LOOP FURRY PORN GAMES C SERVICES [?] [R] RND POPULAR | Archived flashes: 229595 |
/disc/ · /res/ — /show/ · /fap/ · /gg/ · /swf/ | P0001 · P2595 · P5190 |
A Very Merry Christmas! |
This is the info page for Flash #68789 |
LOADING |
LOATHN |
LOATH |
LOAT |
LPAT |
LPAY |
PLAY |
NEWGROUNDS |
PLAY |
PLAY |
How to make a preloader with As3 |
How to make a preloader with As3 |
-The necesary animations |
-The necesary animations |
-The Code |
-The Code |
-Completed Script |
-Completed Script |
Necessary Animations |
You will need these animations: A movieclip, like this: |
It will run while the movie is loading, so people won`t get bored before the actuall Flash starts playing |
Necessary Animations |
You will need these animations: Another movieclip with 100 frames, like this: |
We will link this to the percents loaded, and use it instead of a generic loading-bar, since those are boooooring! |
You will need these animations: A simple play button, a la whats below |
This baby will be waiting at the second frame, ready to launch the flash at command! |
This is probably the part why you are watching this in the first place, so read carefully. After putting Your two Movieclips on different layers on the first frame, right- click on the first frame on the timeline and choose "actions" in the dropdown- menue. |
Next up is the actual code. Move the mouse over the Code on the next frames to get more information on the why. |
The Code |
Stage. tells As3 where to execute the script, in this case stage, which basically is your entire flash. addEventListener tells the script to wait for a specific action as specified in the brackets, in this case: Event.ENTER_FRAME which stands for execute as soon as the flash enters a frame ItsAMe is the action that the listener executes, you may have guessed by the name that this is an action i created, more on this later. |
function ItsAMe, defines the function ItsAMe, see i told you we would see this again. As for now, this will be executed as soon as the flash enters a frame, because of the first line. (event:Event) tells that the event type is an Event, and not something as MouseEvent, which we will use later and which is linked to Mouseactions (duh). void tells that this event wont return any value. Basiclly spells:nothing of interest here. What this function does is specified in the following braces. |
stop (); keeps the flash from progresing to the next frame |
if tells the flash to do something if the following parameters in the braces are true. In this case if framesLoaded (you know what this is coding for) is bigger than or equall totalFrames the action in the following brackets is executed. |
This code is executed if the if parameter is true. stage.removeEventlistener(Event.ENTER_FRAME,ItsAMe) removes the very code (ItsAMe) you are reading from functionality, which is a good thing since if it would remain intact so would the stop (); parameter, making it impossible to play the flash. this. basically codes for: watever you have your hands on right now. gotoAndStop(2); tells the flash to go to frame 2 and stop playing, it is here we will put the play-button. |
Spelling: execute what is in the following brackets if the if parameter is untrue. |
This block of code is executed if the else parameter is true. var tells that the following will code for a variable. x:Number tells that the following varible will be a numerical value of watever we call x. stage.loaderInfo.bytesLoaded tells how many bytes of your flash are loaded. stage.loaderInfo.bytesTotal codes for the total amount of bytes in your flash. var percent:Number = Math.round((ThingsLoaded/AllIsThere)*100) basically says custom value.x divided by custom value.y is custom value.z rounded to real numbers(Math.round) times 100. this.TheLoadingBarOfEvil.gotoAndStop (percent); says that a movieclip called TheLoadingBarOfEvil will show its frames linked to our custom value percent. TheLoadingBarOfEvil of course is our loadingbar-movieclip. Informations on how to asign names to MCs on the next frame. |
Assigning coding names to Movieclips |
it is done here |
Something is missing, issn't it? Our Play button of course! It is however quite easily to place. Insert a new keyframe on your preload-layer and replace the lodingbar on the second frame with it. Our real movieclip may stay in place, so that it keeps playing. The only thing missing now is the script for the button. It is on the next frame. Just place it in the second frame, and you should be fine. On we go, to the next frame! |
If you read my notes on the other script you should know most of this. TheFilmStartingThing, is of course our play-button. import flash.events.MouseEvent; enables Mouseevents. MOUSE_Up is one of these, it activates the action on release of the button. And you should already known the rest. |
You will probably want to test you your film now, to see if the script works. To do this go to the control panell and select "test film" (or something similar, I do not use the english version) in the dropdown menu. In the popup-window that opens, you can simulate a download by selecting: view- simulate download, you can also select different download types at download properties. Test at all speeds or you might miss an error linked to download-speed (as the creator of a certain tutorial, sigh). If you get an error containing something as: Error #1009 blabla nullobject reference blabla, it is because of frame 3 loading before the code (I think). You can solve this by placing a fairly big picture (30 kb worked for me) from your flash anywhere on the 2 frame. This should make sure that the Flash does not proceed to the next frame before the script is fully loaded. |
That was it, nothing more to get here... |
Back to the menu ? |
Back to the menu ? |
Back to the menu ? |
ActionScript [AS3]
Section 1//MainTimeline (4_fla.MainTimeline) package 4_fla { import flash.events.*; import flash.display.*; public dynamic class MainTimeline extends MovieClip { public var Menü:SimpleButton; public var Script:SimpleButton; public var Scripting:SimpleButton; public var nächsta:SimpleButton; public var TheFilmStartingThing:SimpleButton; public var Animation:SimpleButton; public var TheLoadingBarOfEvil:MovieClip; public var vorheriga:SimpleButton; public function MainTimeline(){ addFrameScript(0, frame1, 1, frame2, 2, frame3, 12, frame13); } public function scr(_arg1:MouseEvent):void{ this.gotoAndStop(7); } public function nächste(_arg1:MouseEvent):void{ this.nextFrame(); } public function ItsAMe(_arg1:Event):void{ var _local2:Number; var _local3:Number; var _local4:Number; stop(); if (framesLoaded >= totalFrames){ stage.removeEventListener(Event.ENTER_FRAME, ItsAMe); this.gotoAndStop(2); } else { _local2 = stage.loaderInfo.bytesLoaded; _local3 = stage.loaderInfo.bytesTotal; _local4 = Math.round(((_local2 / _local3) * 100)); this.TheLoadingBarOfEvil.gotoAndStop(_local4); }; } public function vorherige(_arg1:MouseEvent):void{ this.prevFrame(); } public function StartItDamnIt(_arg1:MouseEvent):void{ this.gotoAndStop(3); } function frame3(){ nächsta.addEventListener(MouseEvent.MOUSE_UP, nächste); vorheriga.addEventListener(MouseEvent.MOUSE_UP, vorherige); Animation.addEventListener(MouseEvent.MOUSE_UP, nec); Scripting.addEventListener(MouseEvent.MOUSE_UP, scr); Script.addEventListener(MouseEvent.MOUSE_UP, scrt); } function frame13(){ Menü.addEventListener(MouseEvent.MOUSE_UP, Menue); } function frame1(){ stage.addEventListener(Event.ENTER_FRAME, ItsAMe); } function frame2(){ TheFilmStartingThing.addEventListener(MouseEvent.MOUSE_UP, StartItDamnIt); } public function scrt(_arg1:MouseEvent):void{ this.gotoAndStop(8); } public function nec(_arg1:MouseEvent):void{ this.gotoAndStop(4); } public function Menue(_arg1:MouseEvent):void{ this.gotoAndStop(3); } } }//package 4_fla
Library Items
Symbol 1 Graphic | Used by:Timeline | |
Symbol 2 Graphic | Used by:17 Timeline | |
Symbol 3 Font | Used by:4 11 12 13 14 15 16 28 29 35 37 38 39 42 43 45 46 53 54 55 57 58 59 60 61 62 63 64 95 96 98 101 102 103 104 105 106 | |
Symbol 4 Text | Uses:3 | Used by:17 |
Symbol 5 Graphic | Used by:17 | |
Symbol 6 Graphic | Used by:17 | |
Symbol 7 Graphic | Used by:17 | |
Symbol 8 Graphic | Used by:17 | |
Symbol 9 Graphic | Used by:17 | |
Symbol 10 Graphic | Used by:17 | |
Symbol 11 Text | Uses:3 | Used by:17 |
Symbol 12 Text | Uses:3 | Used by:17 |
Symbol 13 Text | Uses:3 | Used by:17 |
Symbol 14 Text | Uses:3 | Used by:17 |
Symbol 15 Text | Uses:3 | Used by:17 |
Symbol 16 Text | Uses:3 | Used by:17 31 |
Symbol 17 MovieClip | Uses:2 4 5 6 7 8 9 10 11 12 13 14 15 16 | Used by:Timeline |
Symbol 18 Graphic | Used by:25 | |
Symbol 19 Graphic | Used by:25 | |
Symbol 20 Graphic | Used by:25 | |
Symbol 21 Graphic | Used by:25 | |
Symbol 22 Graphic | Used by:25 | |
Symbol 23 Graphic | Used by:25 | |
Symbol 24 Graphic | Used by:25 | |
Symbol 25 MovieClip | Uses:18 19 20 21 22 23 24 | Used by:Timeline |
Symbol 26 Font | Used by:27 | |
Symbol 27 Text | Uses:26 | Used by:Timeline |
Symbol 28 Text | Uses:3 | Used by:31 |
Symbol 29 Text | Uses:3 | Used by:31 |
Symbol 30 Graphic | Used by:31 | |
Symbol 31 Button | Uses:16 28 29 30 | Used by:Timeline |
Symbol 32 Bitmap | Used by:33 36 | |
Symbol 33 Graphic | Uses:32 | Used by:Timeline |
Symbol 34 Graphic | Used by:Timeline | |
Symbol 35 Text | Uses:3 | Used by:Timeline |
Symbol 36 Graphic | Uses:32 | Used by:Timeline |
Symbol 37 Text | Uses:3 | Used by:Timeline |
Symbol 38 Text | Uses:3 | Used by:41 |
Symbol 39 Text | Uses:3 | Used by:41 |
Symbol 40 Graphic | Used by:41 44 47 | |
Symbol 41 Button | Uses:38 39 40 | Used by:Timeline |
Symbol 42 Text | Uses:3 | Used by:44 |
Symbol 43 Text | Uses:3 | Used by:44 |
Symbol 44 Button | Uses:42 43 40 | Used by:Timeline |
Symbol 45 Text | Uses:3 | Used by:47 |
Symbol 46 Text | Uses:3 | Used by:47 |
Symbol 47 Button | Uses:45 46 40 | Used by:Timeline |
Symbol 48 Graphic | Used by:49 | |
Symbol 49 Button | Uses:48 | Used by:Timeline |
Symbol 50 Graphic | Used by:51 | |
Symbol 51 Button | Uses:50 | Used by:Timeline |
Symbol 52 Graphic | Used by:Timeline | |
Symbol 53 Text | Uses:3 | Used by:Timeline |
Symbol 54 Text | Uses:3 | Used by:Timeline |
Symbol 55 Text | Uses:3 | Used by:Timeline |
Symbol 56 Graphic | Used by:Timeline | |
Symbol 57 Text | Uses:3 | Used by:Timeline |
Symbol 58 Text | Uses:3 | Used by:Timeline |
Symbol 59 Text | Uses:3 | Used by:Timeline |
Symbol 60 Text | Uses:3 | Used by:Timeline |
Symbol 61 Text | Uses:3 | Used by:Timeline |
Symbol 62 Text | Uses:3 | Used by:Timeline |
Symbol 63 Text | Uses:3 | Used by:Timeline |
Symbol 64 Text | Uses:3 | Used by:Timeline |
Symbol 65 Bitmap | Used by:66 | |
Symbol 66 Graphic | Uses:65 | Used by:Timeline |
Symbol 67 Bitmap | Used by:68 | |
Symbol 68 Graphic | Uses:67 | Used by:Timeline |
Symbol 69 Graphic | Used by:73 | |
Symbol 70 Font | Used by:71 75 79 82 85 88 91 | |
Symbol 71 Text | Uses:70 | Used by:73 |
Symbol 72 Graphic | Used by:73 | |
Symbol 73 Button | Uses:69 71 72 | Used by:Timeline |
Symbol 74 Graphic | Used by:77 | |
Symbol 75 Text | Uses:70 | Used by:77 |
Symbol 76 Graphic | Used by:77 80 83 86 89 92 | |
Symbol 77 Button | Uses:74 75 76 | Used by:Timeline |
Symbol 78 Graphic | Used by:80 | |
Symbol 79 Text | Uses:70 | Used by:80 |
Symbol 80 Button | Uses:78 79 76 | Used by:Timeline |
Symbol 81 Graphic | Used by:83 | |
Symbol 82 Text | Uses:70 | Used by:83 |
Symbol 83 Button | Uses:81 82 76 | Used by:Timeline |
Symbol 84 Graphic | Used by:86 | |
Symbol 85 Text | Uses:70 | Used by:86 |
Symbol 86 Button | Uses:84 85 76 | Used by:Timeline |
Symbol 87 Graphic | Used by:89 | |
Symbol 88 Text | Uses:70 | Used by:89 |
Symbol 89 Button | Uses:87 88 76 | Used by:Timeline |
Symbol 90 Graphic | Used by:92 | |
Symbol 91 Text | Uses:70 | Used by:92 |
Symbol 92 Button | Uses:90 91 76 | Used by:Timeline |
Symbol 93 Bitmap | Used by:94 | |
Symbol 94 Graphic | Uses:93 | Used by:Timeline |
Symbol 95 Text | Uses:3 | Used by:Timeline |
Symbol 96 Text | Uses:3 | Used by:Timeline |
Symbol 97 Graphic | Used by:Timeline | |
Symbol 98 Text | Uses:3 | Used by:Timeline |
Symbol 99 Bitmap | Used by:100 | |
Symbol 100 Graphic | Uses:99 | Used by:Timeline |
Symbol 101 Text | Uses:3 | Used by:Timeline |
Symbol 102 Text | Uses:3 | Used by:Timeline |
Symbol 103 Text | Uses:3 | Used by:Timeline |
Symbol 104 Text | Uses:3 | Used by:108 |
Symbol 105 Text | Uses:3 | Used by:108 |
Symbol 106 Text | Uses:3 | Used by:108 |
Symbol 107 Graphic | Used by:108 | |
Symbol 108 Button | Uses:104 105 106 107 | Used by:Timeline |
Instance Names
"TheLoadingBarOfEvil" | Frame 1 | Symbol 17 MovieClip |
"TheFilmStartingThing" | Frame 2 | Symbol 31 Button |
"Animation" | Frame 3 | Symbol 41 Button |
"Scripting" | Frame 3 | Symbol 44 Button |
"Script" | Frame 3 | Symbol 47 Button |
"vorheriga" | Frame 3 | Symbol 49 Button |
"nächsta" | Frame 3 | Symbol 51 Button |
"Menü" | Frame 13 | Symbol 108 Button |
Special Tags
FileAttributes (69) | Timeline Frame 1 | Access local files only, Metadata not present, AS3. |
|