Flash skip preloader in AS3

Hi, I searched the internet but I couldn't find a solution to skip the preloader in AS3. All I found was for AS2 (Maybe I didn't search well )
When I visit my page again and the flash has already been loaded, I get stuck on frame 1 and the movie does not continue to where it supposed to be. Is there a way to skip the preloader if the swf has already been preloaded or cached?
Here is my actionscript:
//Import the required assets
import flash.display.*;
//Stop the playhead while loading occurs
this.stop();
//Create a listener to call the loading function as the movie loads
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);
/*This is the main function, basically it grabs the total and loaded bytes,
calculates a percentage, and displays it by stretching the bar and adjusting
the textfield display. If your bar/textbox instancenames are NOT lbar/lpc,
you'll need to adjust this code to match your instance names*/
function PL_LOADING(event:ProgressEvent):void {
var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
//Stretch the bar
lbar.scaleX=pcent/100;
//Display the % loaded in textfield
lpc.text=int(pcent)+"%";
//If the movie is fully loaded, kick to the next frame on the main timeline
//You may wish to change the gotoAndStop(2) to a gotoAndPlay(2)
if(pcent==100){
this.gotoAndStop(2);
Thanks to anyone who helps.

use:
//Import the required assets
import flash.display.*;
//Stop the playhead while loading occurs
this.stop();
//Create a listener to call the loading function as the movie loads
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);
this.loaderInfo.addEventListener(Event.COMPLETE,loadCompleteF);
function loadCompleteF(e:Event){
this.gotoAndStop(2);
/*This is the main function, basically it grabs the total and loaded bytes,
calculates a percentage, and displays it by stretching the bar and adjusting
the textfield display. If your bar/textbox instancenames are NOT lbar/lpc,
you'll need to adjust this code to match your instance names*/
function PL_LOADING(event:ProgressEvent):void {
var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
//Stretch the bar
lbar.scaleX=pcent/100;
//Display the % loaded in textfield
lpc.text=int(pcent)+"%";
//If the movie is fully loaded, kick to the next frame on the main timeline
//You may wish to change the gotoAndStop(2) to a gotoAndPlay(2)
if(pcent==100){
this.gotoAndStop(2);

Similar Messages

  • Flash CS5 preloading before frame 1

    Hi all
    Im having a nightmare with a preloader in as3 and cs5. No matter what happens, flash displays its own preloader (ie 5 little circles at centre stage) and loads the whole flash file before it gets to frame 1. does anyone know how to stop flash doing this so i can use my own preloader. Im hoping that its an easy fix
    Kind Regards Dave

    Thanks for the quick response, one thing I dont understand though, if I remove all functions with duplicate names, what do I replace them with? or what do I do to get the same results? All I want to do is get 3 contact forms up and running, what other function names could be used? Please help, thanks...

  • Preloader in AS3

    hi,
    Can u give  me any idea how to creat preloader in as3..
    Plz help me guys m new in as3
    Thanks,
    JaxNa

    on first Key frame the following code
    loader is a movie Clip
    percent is a text field
    stop();
    addEventListener(Event.ENTER_FRAME, preloader);
    function preloader(evet:Event){   
        var load_value:Number = this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal;
        loader.scaleX = load_value;
        if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
            this.gotoAndStop(2);
            removeEventListener(Event.ENTER_FRAME, preloader);

  • Simple preloader in AS3 - HELP

    Hi,
    Could anyone please point me in the direction or tell me how
    to build a simple preloader in AS3/PlashPlayer 9.
    I'd just like to have a movie clip in frame one which
    animates until the rest of the timeline has loaded, then once
    loaded go to frame 2.
    I've had a look in the doucumentation and around the web to
    find something but can't find anything that works and I'm finding
    it quite hard.
    Thanks in advance

    These screen captures show the library of the movie. As you can see I export the most of them. However I have doubts about if I must convert to symbol the graphics. I have the preloader in the "presentación" folder without any exportation.
    Please, Could you correct the website?. Please, tell me an e-mail address and I send you the website via WeTransfer.

  • Flash Pro CS5.5+AS3 + iOS (iPhone) build specifically

    To start with, I really need some simple, definative examples of building a Facebook app for the iPhone using Flash Pro CS5.5+AS3 + iOS (iPhone).
    There are endless examples for nearly every platform on the planet - except this one, and in nearly every language except Flash Pro CS5.5+AS3 + iOS (iPhone).
    This is just one I have found that has some very good descriptions - albeit using coding other than what I want - but there is a link at the bottom to a downloadable AS sample.
    http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/
    So in simple terms.
    I'm using
    Flash Pro CS5.5+AS3 + iOS (iPhone)
    I have the
    GRAPH 1_8_1.swc files ... and as near as I can figure, I use the mobile.swc version?
    My problem is that I don't see a lot of development on the Adobe discussion forums specifically targeted at the iOS iPhone/iPod touch model
    Does anyone know of good tutorials, samples, (please no videos - impossible to follow usually, and often very poorly done...)
    I want to be able to Authorize a user for Facebook, and store the login in a "private var sharedObj:SharedObject;" setup, and the authorization is done in a StageWebView setup,
    and after all is authorized, the webview closes, and the user then only has to tap a button, and a pre-formatted string is posted to their newsfeed, any time they press the Post to Facebook button, the updated string will be posted.
    Simple really. I don't want lists of friends, photos images or even to be able to read the newsfeed - just post to it.
    but ... I can't find a darn thing.
    thanks

    the project panel is just a convenience panel for you to use to access your flash project's files without using a file browser.  it has nothing to do with your publish settings.
    if you don't see a great need to forego using your file browser, join the crowd.  the project panel was an idea with no great benefit.
    someone probably made a big to-do about it and got enough people to vote for the feature so adobe added the feature.  and then found nobody cared so, it's not going to be in the next flash pro version.

  • Cool preloader in as3 to as3

    Hi to everyone ....
    I use this preloader in several of my professional works and it's cool ... but in futures works i'll need't in AS23. ¿Is there a way to converted (or make it) in AS3?.
    Otherwise is there a web site where i can find cool flash preloaders ???
    Thanks ...

    It's more likely you'll get help when you don't require people to do research.  If you can describe how your current preloader is designed and show the code it uses you'll be helping others to help you.

  • Adobe Flash CS5 Preloader Taking Too Long

    Using Adobe Flash CS5.
    Created a 1mb (.swf) presentation (images, transitions, voice-over, etc).
    Used the Preloader for SWF template from Flash CS5 library.
    Copied the code into its own layer called "AS3" into frame 1.
    Copied the little text box with instance name percent_txt into frame 1.
    Everything else starts in frame 2.
    The profiler still reads about 300kb in the first frame and it takes until about 50% (about 20 seconds at 56kb dl) until the simple image I put on frame 1 appears.
    I read on this forum something about "exporting about 1mb of assets in your first frame", but I don't understand what that means...

    Ok, I found the Flash Settings...
    In Publish Settings, Flash Tab... next to the Script: ActionScript 3.0, I clicked the "settings" button and changed the "Export classes in frame:" option to "2"
    What I still don't understand is why the preloader doesn't show until about 450kb of my 900kb file is downloaded!
    I don't have anything else in frame 1, yet it's still got that spike at about 500kb. How do I get rid of that so my preloader starts showing almost immediately?

  • Help with a preloader in AS3

    Hi,
    I upload a website and I have problems with the preloader did it in AS3. It starts after two or three minutes. I have a MC with an animation of 100 frames and the dynamic text of the percent. The preloader is located in the 1 frame to the 10, I mean, first frame with the actions and the other three layers (text, MC and background) with a lenght of 10. The movie has 525 frames. Here is the code:
    stop();
    addEventListener(Event.ENTER_FRAME, lodeando);
    function lodeando(event:Event):void
              var bytesTotales = stage.loaderInfo.bytesTotal;
              var bytesCargados = stage.loaderInfo.bytesLoaded;
              var porcentaje = Math.round(bytesCargados * 100 / bytesTotales);
              textoPorcentaje.text = porcentaje + "% Cargados";
              cargaAnimada_mc.gotoAndStop(porcentaje);
              if (bytesCargados == bytesTotales)
                        removeEventListener(Event.ENTER_FRAME, lodeando);
                        gotoAndPlay(2);
                        textoPorcentaje.text = "";
                        removeChild(textoPorcentaje);
                        removeChild(cargaAnimada_mc);
    Please, Could you help me?.

    These screen captures show the library of the movie. As you can see I export the most of them. However I have doubts about if I must convert to symbol the graphics. I have the preloader in the "presentación" folder without any exportation.
    Please, Could you correct the website?. Please, tell me an e-mail address and I send you the website via WeTransfer.

  • Save data to mysql using AS3 + Flash Builder(flex) OR AS3+AMFPHP? or AS3

    Hi,
    i just want to confirm with you guys about saving data to mysql using Action script 3.
    I am now developing RPG game that user can save data again and again to the MySQL.
    I searched on the net and found few solutions:
    AS3 alone using URL Loader
    AS3 + Flex +Php to save data to mysql
    AS3 + AMFPHP to save data to mysql
    This make me confused as there are too many options but i do not know which one is better for me
    or what are their limitations...
    Could you guys help me on this?

    For developing you can use the server (install like any other software), but the Zend framework is nothing more than php files, so all you need to do is upload the framework to you hosting server and all should be well.. You may have to configure a few things, but you should be able to do that yourself.
    There's plenty of documentation on installing and configuring Zend on their website.
    So, only get the server edition if you don't already have a dev server (on you computer) installed, like Apache. Otherwise, just grab the framework:
    http://framework.zend.com/download/latest
    Select "minimal package" on the page above to only get the framework (no install). Or grab both and see what each one does but the minimal package is what you need to upload to your hosting server.
    As for where Flex/Flash Builder comes in.. FB is the tool you use to create a Flash/Flex application.
    Zend, AMFPHP, etc.. is used to communicate with your backend from your application, using RemoteObject
    RemoteObject API
    http://livedocs.adobe.com/flex/3/langref/mx/rpc/remoting/RemoteObject.html
    Using RemoteObject components
    http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html

  • Converting Flash Remoting AS2 to AS3

    Hello
    I was wondering if someone could direct me to some tutorials
    on Flash Remoting for AS3.
    I would like to convert my old AS2 code over but I can't find
    any information on that.
    Does this functionality still exist for AS3?
    Adam

    See
    http://ssr.riaforge.org/

  • Help! Convert simple Flash AS2 code to AS3

    Hi everyone,
    I'm a Flash beginner and followed a tutorial: http://www.webwasp.co.uk/tutorials/018/tutorial.php ... to learn how to make a "live paint/draw" effect. I didn't realize  that if I made something in AS2, I wouldn't be able to embed it (and  have it work) into my root AS3 file, where I've got a bunch of other  stuff going on. I've tried following tips on how to change AS2 code to  AS3, but it just doesn't work. I know it's simple code, and that some  genius out there can figure it out, but I'm at a loss. Please help!
    Here's the AS2 code:
    _root.createEmptyMovieClip("myLine", 0);
    _root.onMouseDown = function() {
       myLine.moveTo(_xmouse, _ymouse);
       ranWidth = Math.round((Math.random() * 10)+2);
       myLine.lineStyle(ranWidth, 0xff0000, 100);
       _root.onMouseMove = function() {
          myLine.lineTo(_xmouse, _ymouse);
    _root.onMouseUp = function() {
       _root.onMouseMove = noLine;
    Thanks in advance!
    Signed,
    Nicolle
    Flash Desperado

    Considering the code is on timeline:
    var myLine:Sprite = new Sprite();
    addChild(myLine);
    var g:Graphics = myLine.graphics;
    addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
    function onMouseDown(e:MouseEvent):void {
         var ranWidth:Number = Math.round((Math.random() * 10) + 2);
         g.clear();
         g.lineStyle(ranWidth, 0xFF0000, 1);
         addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
         addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
    function onMouseMove(e:MouseEvent):void {
         g.lineTo(mouseX, mouseY);
    function onMouseUp(e:MouseEvent):void {
         removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
         removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);

  • Flash 8 - Preloader

    Bonjour. J'ai un problème de preloader, lorsque je mon
    swf en ligne, le preloader s'arrête à 32%.Voyez
    plutôt :
    http://remx.info/ .Ce n'est pas la
    première fois que ça m'arrive. Pourriez-vous me dire
    à quoi cela est dû ? Merci d'avance.
    Voici mon script :
    // frame 1
    total_bytes = _root.getBytesTotal();
    loaded_bytes = _root.getBytesLoaded();
    remaining_bytes = total_bytes-loaded_bytes;
    percent_done = int((loaded_bytes/total_bytes)*100);
    bar.gotoAndStop(percent_done);
    ifFrameLoaded ("Séquence 2", 1) {
    gotoAndStop(3);
    // frame 2
    gotoAndPlay(1);
    Petite question subsidiaire : Comment fait-on pour supprimer
    ou déplacer une séquence ?
    Merci.

    Il faudrait peut-�tre d�j� essayer de
    faire un preloader correct !
    http://www.google.nl/search?hs=0gT&hl=nl&client=firefox-a&rls=org.mozilla%3Aen-GB%3Aoffici al_s&q=flash%2Bprechargement&btnG=Zoeken&meta=
    http://bolo.developpez.com/prechargement/
    e-S-tampida
    http://development.bbri.be/elearning2
    (pre-release version V2.3.2)
    A tous ceux qui ne lisent pas la documentation (livre ou F1)
    http://development.bbri.be/ictp/flash/rtdfm.jpg
    "Remxxx" <[email protected]> wrote in
    message
    news:e2862r$9de$[email protected]..
    > Bonjour. J'ai un probl?me de preloader, lorsque je mon
    swf en ligne, le
    > preloader s'arr?te ? 32%.Voyez plut?t :
    http://remx.info/ .Ce n'est pas la
    > premi?re fois que ?a m'arrive. Pourriez-vous me dire ?
    quoi cela est d? ?
    > Merci
    > d'avance.
    > Voici mon script :
    >
    > // frame 1
    > total_bytes = _root.getBytesTotal();
    > loaded_bytes = _root.getBytesLoaded();
    > remaining_bytes = total_bytes-loaded_bytes;
    > percent_done = int((loaded_bytes/total_bytes)*100);
    > bar.gotoAndStop(percent_done);
    > ifFrameLoaded ("S?quence 2", 1) {
    > gotoAndStop(3);
    > }
    >
    > // frame 2
    > gotoAndPlay(1);
    >
    > Petite question subsidiaire : Comment fait-on pour
    supprimer ou d?placer
    > une
    > s?quence ?
    > Merci.
    >

  • Move Flash Form Preloader

    I have a 2200px hight form. I would like the Preloader and
    error message window to display in the center of the
    viewport(browser) but instead displays in the center of the form
    which is not in the users view at all times.
    Does anyone know how to move these elements?

    Hi Mary,
    Do your input text fields have the correct names that the PHP
    is looking for?
    eg...
    household
    water
    soft
    bottle
    comments
    namebus
    address1
    address2
    phone
    email
    I dont know a whole lot about intergating PHP and Flash
    mailing forms, but I remember when I started, I had this problem
    too.
    It's worth a try.
    hope this helps.

  • Flash 9 Prewiev. As3 script check

    Please, let me ask your immediate help - in case anybody
    knows Flash 9 Prewiev.
    When I check As3 script it outputs err msg: " The class or
    interface 'Sprite' could not be loaded."
    I cannot check script at all.
    $(LocalData)/Classes is set in Preferences -
    though As3 is compiled, but script check does not work.
    Thanks Lant

    Well, in fact that's all the help you need.
    For instance:
    flash.geom.ColorTransform -> Examples.
    So, how to use this in the Public Alpha. Well, create a new
    ActionScript file, copy and paste the code and save the file as
    ColorTransformExample.as
    Now open a new Flash file. Go to the Publish Settings and
    click on 'settings' next to the dropdown that says 'ActionScript
    3.0'. A new option! Document Class (you can 'connect' a base class
    to the -what was called - _root). Type in: ColorTransformExample
    (without .as) and click ok. Save the fla in the same directory as
    where you saved ColorTransformExample.as. Test the movie. Attached
    for your convenience the class.

  • How do I add flash cs4 game with AS3 to flash cs4 website??

    I have created a game in flash with ActionScript 3 and now want to add it to a website I have created with pages seperated into keyframes. Ideally, I am trying to have the game start when a link on the home page is selected. I would also like the users to be able to download the game themselves??? Any ideas for a flash novice??

    Thank you so much!!! I just added it with a UI Loader Component! Worked really well... although it looks like doing that picked up an issue with some of my code? It's now looping over and over again and the counter within my game (for giving players their score - highlighted in red), is not working?If you are a AS3 guru any help would be greatly appreciated, otherwise thank you so much for your earlier tips
    package
        import flash.display.MovieClip;
        import flash.events.*;
        import flash.utils.Timer;
        import flash.text.*;
        public dynamic class Gift extends MovieClip
            private var dx:Number = Math.random() * 10; // make gift scurry
            private var dy:Number = Math.random() * 10;
            public function Gift ()
                this.gotoAndStop(Math.ceil(Math.random() * 4));
                this.addEventListener(Event.ENTER_FRAME, scurry);   
                stage.addEventListener(MouseEvent.MOUSE_DOWN, kill);
            public function scurry (e:Event)
                if (this.x < 0 || this.x > 550)
                    this.dx *= -1;
                if (this.y < 0 || this.y > 576)
                    this.dy *= -1;
                this.x += this.dx; // make gift scurry
                this.y += this.dy;
            public function die()
                this.removeEventListener(Event.ENTER_FRAME, scurry);
                parent.removeChild(this);
            private function kill (e:MouseEvent):void
                if(e.target is Gift)
                    e.target.die();
                    score += 10;
                    scoreText.text = score.toString();

Maybe you are looking for

  • Screen Resolution changes on published file - please help

    Hello, I currently have my screen res in my projects set at 1024 x 768 - on some files (not all) when I publish the output generates with a resolution of 1220 x 1220??? I have absolutely no idea how this can be possible as I have checked and double c

  • Make screenshots jpg with lion

    I am a first time owner of a mac (imac).  When I perform a screenshot, it is in a png format.  I need to change the format to jpg.  I keep reading that I should open it with preview and do save as... I now know that the new version of preview no long

  • LOV page not opened after an insert action

    (Using jdev 10.1.3.4.0.4270) I have an overview page with a detail edit/create page. On the edit/create page are some(5) LOV's. These LOV's are actualy created as : <afh:cellFormat> <af:commandLink id="lov_link_product" useWindow="true" action="dialo

  • Common GoldenGate errors

    GG version 11.2.1.0.3 OS: Unix/Unix-like For a typical Unidirectional configuration where only DML is replicated , what are the most common errors you usually encounter with GoldenGate ? Just name a few.

  • Can one use  the iphone with car  stereo systems as one does an ipod?

    My car has a "jack" for mpegs/ipod to interlace with the existing stereo. Is there an accessory that will allow me to use my iphone as one would an ipod with such systems?