STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228086
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/46078350?noj=FRM46078350-2DC" width="1" height="1"></div>

As3 Preloder Tutorial.swf

This is the info page for
Flash #68789

(Click the ID number above for more basic data on this flash file.)


Text
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 GraphicUsed by:Timeline
Symbol 2 GraphicUsed by:17  Timeline
Symbol 3 FontUsed 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 TextUses:3Used by:17
Symbol 5 GraphicUsed by:17
Symbol 6 GraphicUsed by:17
Symbol 7 GraphicUsed by:17
Symbol 8 GraphicUsed by:17
Symbol 9 GraphicUsed by:17
Symbol 10 GraphicUsed by:17
Symbol 11 TextUses:3Used by:17
Symbol 12 TextUses:3Used by:17
Symbol 13 TextUses:3Used by:17
Symbol 14 TextUses:3Used by:17
Symbol 15 TextUses:3Used by:17
Symbol 16 TextUses:3Used by:17 31
Symbol 17 MovieClipUses:2 4 5 6 7 8 9 10 11 12 13 14 15 16Used by:Timeline
Symbol 18 GraphicUsed by:25
Symbol 19 GraphicUsed by:25
Symbol 20 GraphicUsed by:25
Symbol 21 GraphicUsed by:25
Symbol 22 GraphicUsed by:25
Symbol 23 GraphicUsed by:25
Symbol 24 GraphicUsed by:25
Symbol 25 MovieClipUses:18 19 20 21 22 23 24Used by:Timeline
Symbol 26 FontUsed by:27
Symbol 27 TextUses:26Used by:Timeline
Symbol 28 TextUses:3Used by:31
Symbol 29 TextUses:3Used by:31
Symbol 30 GraphicUsed by:31
Symbol 31 ButtonUses:16 28 29 30Used by:Timeline
Symbol 32 BitmapUsed by:33 36
Symbol 33 GraphicUses:32Used by:Timeline
Symbol 34 GraphicUsed by:Timeline
Symbol 35 TextUses:3Used by:Timeline
Symbol 36 GraphicUses:32Used by:Timeline
Symbol 37 TextUses:3Used by:Timeline
Symbol 38 TextUses:3Used by:41
Symbol 39 TextUses:3Used by:41
Symbol 40 GraphicUsed by:41 44 47
Symbol 41 ButtonUses:38 39 40Used by:Timeline
Symbol 42 TextUses:3Used by:44
Symbol 43 TextUses:3Used by:44
Symbol 44 ButtonUses:42 43 40Used by:Timeline
Symbol 45 TextUses:3Used by:47
Symbol 46 TextUses:3Used by:47
Symbol 47 ButtonUses:45 46 40Used by:Timeline
Symbol 48 GraphicUsed by:49
Symbol 49 ButtonUses:48Used by:Timeline
Symbol 50 GraphicUsed by:51
Symbol 51 ButtonUses:50Used by:Timeline
Symbol 52 GraphicUsed by:Timeline
Symbol 53 TextUses:3Used by:Timeline
Symbol 54 TextUses:3Used by:Timeline
Symbol 55 TextUses:3Used by:Timeline
Symbol 56 GraphicUsed by:Timeline
Symbol 57 TextUses:3Used by:Timeline
Symbol 58 TextUses:3Used by:Timeline
Symbol 59 TextUses:3Used by:Timeline
Symbol 60 TextUses:3Used by:Timeline
Symbol 61 TextUses:3Used by:Timeline
Symbol 62 TextUses:3Used by:Timeline
Symbol 63 TextUses:3Used by:Timeline
Symbol 64 TextUses:3Used by:Timeline
Symbol 65 BitmapUsed by:66
Symbol 66 GraphicUses:65Used by:Timeline
Symbol 67 BitmapUsed by:68
Symbol 68 GraphicUses:67Used by:Timeline
Symbol 69 GraphicUsed by:73
Symbol 70 FontUsed by:71 75 79 82 85 88 91
Symbol 71 TextUses:70Used by:73
Symbol 72 GraphicUsed by:73
Symbol 73 ButtonUses:69 71 72Used by:Timeline
Symbol 74 GraphicUsed by:77
Symbol 75 TextUses:70Used by:77
Symbol 76 GraphicUsed by:77 80 83 86 89 92
Symbol 77 ButtonUses:74 75 76Used by:Timeline
Symbol 78 GraphicUsed by:80
Symbol 79 TextUses:70Used by:80
Symbol 80 ButtonUses:78 79 76Used by:Timeline
Symbol 81 GraphicUsed by:83
Symbol 82 TextUses:70Used by:83
Symbol 83 ButtonUses:81 82 76Used by:Timeline
Symbol 84 GraphicUsed by:86
Symbol 85 TextUses:70Used by:86
Symbol 86 ButtonUses:84 85 76Used by:Timeline
Symbol 87 GraphicUsed by:89
Symbol 88 TextUses:70Used by:89
Symbol 89 ButtonUses:87 88 76Used by:Timeline
Symbol 90 GraphicUsed by:92
Symbol 91 TextUses:70Used by:92
Symbol 92 ButtonUses:90 91 76Used by:Timeline
Symbol 93 BitmapUsed by:94
Symbol 94 GraphicUses:93Used by:Timeline
Symbol 95 TextUses:3Used by:Timeline
Symbol 96 TextUses:3Used by:Timeline
Symbol 97 GraphicUsed by:Timeline
Symbol 98 TextUses:3Used by:Timeline
Symbol 99 BitmapUsed by:100
Symbol 100 GraphicUses:99Used by:Timeline
Symbol 101 TextUses:3Used by:Timeline
Symbol 102 TextUses:3Used by:Timeline
Symbol 103 TextUses:3Used by:Timeline
Symbol 104 TextUses:3Used by:108
Symbol 105 TextUses:3Used by:108
Symbol 106 TextUses:3Used by:108
Symbol 107 GraphicUsed by:108
Symbol 108 ButtonUses:104 105 106 107Used by:Timeline

Instance Names

"TheLoadingBarOfEvil"Frame 1Symbol 17 MovieClip
"TheFilmStartingThing"Frame 2Symbol 31 Button
"Animation"Frame 3Symbol 41 Button
"Scripting"Frame 3Symbol 44 Button
"Script"Frame 3Symbol 47 Button
"vorheriga"Frame 3Symbol 49 Button
"nächsta"Frame 3Symbol 51 Button
"Menü"Frame 13Symbol 108 Button

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS3.




http://swfchan.com/14/68789/info.shtml
Created: 10/4 -2019 19:50:31 Last modified: 10/4 -2019 19:50:31 Server time: 02/05 -2024 18:14:56