Preloading AS3

I have AS3 for a preloader on a first frame of a scene and
also the actual movie clip loading bar on the same frame. After it
loads it sends the user to another scene.
1. Is it ok if the menu bar, dynamic text, and AS3 code for
the preloader are on separate layers?
2. Is there a need to have a second frame with a stop action
after the first?
Thanks.

Yes, you can have various things on various layers in the
preloader, and you do not have to include a stop(); in the second
frame.

Similar Messages

  • Captivate 6 preloader not working

    I have the preloader in Captivate 6 set to 10%.  The original Adobe loading screen appears for 10%, but then a "Loading" screen just appears until the entire project is loaded.  It takes the same amount of time as when the preloader is set to 100%.  The only difference is which "load" screen I'm looking at.  Is there a fix?

    My associate and I are having the same issues any help would be appreciated. We are using Cap 6.0.1.240 64bit Windows 7 machines.  In our project we have mp3 audio files. We also 3 flv files streaming from our Flash server.  We also have question slides but are not utilizing a question pool.  We also have a certificate widget at the end of the project.  We are linking to our content server through Moodle 2.4.  Or swf file is approx 38megs.  We were experiencing significant load times on several different networks with large bandwidth.   We have tried the following:
    - preloader AS3 at 10%
    - reduced the file size significantly (from 138M to 38M)
    - set slides to JPEG
    - made all audio files MP3s
    - off set the audio on slides to begin at .1
    - removed the quiz slides from the project
    - removed the video links from the project
    And still our load times hover around 18 to 25 seconds with each test and the preloader does not work.  Do you have any suggestions that will help?  Is this addressed in ver 7?
    Thank you,
    VJ

  • Preloader not working for 35 MB swf file. Please help!

    Hello,
    I'm working on a glorified slideshow, it has a music track that is 3+ minutes long, pretty nice graphics, and transitions. I started builing in Flash and am halfway done... it looks great too !
    Problem is, when I'm testing the preloader with the download profiler set to DSL - it crawls and at 1% and on, the soundtrack starts to play... by the time the download is at 42% its at least a minute into the soundtrack and it's in and out, coming on then cutting out but not starting over. Needless to say, this is not okay! I know it's a huge file. SHould I maybe export it as an mov and put it in a FLV player?
    Thanks for reading & helping
    Ms.Lee

    Ok, so my preloader code was all wrong, now it's this:
    import flash.events.ProgressEvent;
    var request:URLRequest = new URLRequest("HitTheGround6.swf");
    var ldr:Loader = new Loader();
    this.addChild(ldr);
    ldr.x=0;
    ldr.y=0;
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    ldr.load(request);
    function progressHandler(evt:ProgressEvent):void {
        var percent:Number = evt.target.bytesLoaded / evt.target.bytesTotal;
        preloader.fill.scaleX = percent;
    function completeHandler(evt:Event):void {
        this.removeChild(preloader);
        evt.target.content.gotoAndPlay(2);  //this is the key
    This awesome blog post has the files & explaination!!!
    http://www.negush.net/blog/how-to-preload-as3-clips/

  • Flash movie doesn't load properly in IE only

    I have a simple flash movie which transitions through text and photos. I have a preloader (AS3) on frame 1, which sends the playhead to frame 2, after the movie has loaded 100%. For some reason, in Internet Explorer, the preloader bar will load all the way, but fail to move the playhead to frame 2, so it'll just sit there, with the preload bar at 100%. However, this does not happen every time. For instance, right now, the flash movie will play when I initially go to the website, but when I click on another page, the same flash header (same swf on each page) will just show the preloader bar but will not play the rest of the movie. Reloading the page doesn't help. Closing the browser and reopening it doesn't help. Clearing the browser cache doesn't help either. So, the flash movie will play correctly on the first page of the website I go to (whether it be the home page or another page) but then when I go to any other page which has the flash movie, it won't play, just sits there with the preloader bar showing. And then when going back to the initial page I entered the site on, the flash movie no longer plays there, either. I haven't seen this problem in any other browser than Internet Explorer (6 and 7). I've checked in Firefox on Mac and PC and Safari on Mac. I'm using flash player 10.0.22.87 on my Mac and PC. The flash movie was made in Flash CS3, for flash player 9, actionscript 3 code.
    So, to see the problem, go here in Internet Explorer: http://demo.matthewpavkov.com/adairsolar. Wait for the movie to load and start playing. It works. Then, navigate to one of the other pages and you'll see that the same swf will not play. Navigate back to the home page, the swf does not play.
    Here is the preloader code:
    import flash.display.*;
    this.stop();
    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, PL_LOADING);
    function PL_LOADING(event:ProgressEvent):void {
        var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
        lbar.scaleX=pcent/100;
        lpc.text=int(pcent)+"%";
        if (pcent>=100) {
            this.gotoAndStop(2);
    Also, if I remove the preloader actionscript code, the flash movie plays correctly. You can see that here: http://demo.matthewpavkov.com/adairsolar/no-preload
    The .fla is available to anyone who wants to take a closer look.

    mjjp,
         In may just be that in IE, the ProgressEvent never fires -- because your content is already cached.  See what happens if you add the following new lines (very end of the code sample):
    this.stop();
    this.loaderInfo.addEventListener(
      ProgressEvent.PROGRESS, PL_LOADING
    function PL_LOADING(event:ProgressEvent):void {
      var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
      lbar.scaleX=pcent/100;
      lpc.text=int(pcent)+"%";
      if (pcent>=100) {
        this.gotoAndStop(2);
    if (this.loaderInfo.bytesLoaded >= this.loaderInfo.bytesTotal) {
      this.gotoAndStop(2);
         See what's going on?  This way, even of the ProgressEvent handler never fires, you're still comparing the bytesLoaded property against the bytesTotal property.
    David Stiller
    Adobe Community Expert
    Dev blog, http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Problem with loading new movie.

    Hallo!
    I like to play external preloader before it's load original movie index.swf.
    But I have a problem on resizing index movie.
    Sample files on link http://www.uusrand.eu/galerii/proov/Sample.zip
    Thanks
    Here is preload AS3 code:
    package
        import flash.display.*
        import flash.display.MovieClip;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import flash.net.navigateToURL;
        import flash.net.URLVariables;
        import flash.events.*;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.StageScaleMode;
        import flash.display.StageAlign;
        import flash.display.Sprite;
        public class Preload extends MovieClip
            private var LOADED_CONTENT:Loader = new Loader();
            public function Preload()
                LOADED_CONTENT.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, INDEX_LOADING);
                LOADED_CONTENT.contentLoaderInfo.addEventListener(Event.COMPLETE, INDEX_LOAD_COMPLETE);
                LOADED_CONTENT.load(new URLRequest("index.swf"));
            private function INDEX_LOADING(e:ProgressEvent):void
                mc1.text = int(e.bytesLoaded  / e.bytesTotal * 100) + "%";
            private function INDEX_LOAD_COMPLETE(e:Event):void
                LOADED_CONTENT.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, INDEX_LOADING);
                LOADED_CONTENT.contentLoaderInfo.removeEventListener(Event.COMPLETE, INDEX_LOAD_COMPLETE);
                removeChildAt(0);
                addChild(LOADED_CONTENT);
    And here is index AS3 code:
    package
        import flash.display.*
        import flash.display.MovieClip;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import flash.net.navigateToURL;
        import flash.net.URLVariables;
        import flash.events.*;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import fl.motion.easing.*;
        import flash.display.StageScaleMode;
        import flash.display.StageAlign;
        import flash.display.Sprite;
        public class Index extends MovieClip
            public static var SCREEN_SIZE_W:Number;
            public static var SCREEN_SIZE_H:Number;
            public function Index()
                stage.scaleMode = StageScaleMode.NO_SCALE;
                stage.align = StageAlign.TOP_LEFT;
                STAGE_RESIZE(null);
                stage.addEventListener(Event.RESIZE, STAGE_RESIZE);
                stage.dispatchEvent(new Event(Event.RESIZE));
            private function STAGE_RESIZE(e:Event):void
                if (stage.stageWidth < 500)
                    SCREEN_SIZE_W = 500;
                else
                    SCREEN_SIZE_W = stage.stageWidth;
                if (stage.stageHeight < 400)
                    SCREEN_SIZE_H = 400;
                else
                    SCREEN_SIZE_H = stage.stageHeight;
                mc2.width = SCREEN_SIZE_W - 100;
                mc2.height = SCREEN_SIZE_H - 100;
                mc2.x = SCREEN_SIZE_W / 2;
                mc2.y = SCREEN_SIZE_H;

    Thanks. I don't know is this correct sollution, but this works.
    Here is my change:
    package
        import flash.display.*
        import flash.display.MovieClip;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import flash.net.navigateToURL;
        import flash.net.URLVariables;
        import flash.events.*;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import fl.motion.easing.*;
        import flash.display.StageScaleMode;
        import flash.display.StageAlign;
        import flash.display.Sprite;
        public class Index extends MovieClip
            public static var SCREEN_SIZE_W:Number;
            public static var SCREEN_SIZE_H:Number;
            public function Index()
                stop();
                addEventListener(Event.ADDED_TO_STAGE, INDEX_ADDED_TO_STAGE);
            public function INDEX_ADDED_TO_STAGE(e:Event):void
                play();
                INDEX_ON();
                removeEventListener(Event.ADDED_TO_STAGE, INDEX_ADDED_TO_STAGE);
            private function INDEX_ON():void
                stage.scaleMode = StageScaleMode.NO_SCALE;
                stage.align = StageAlign.TOP_LEFT;
                stage.addEventListener(Event.RESIZE, STAGE_RESIZE);
                STAGE_RESIZE(null);
            private function STAGE_RESIZE(e:Event):void
                if (stage.stageWidth < 500)
                    SCREEN_SIZE_W = 500;
                else
                    SCREEN_SIZE_W = stage.stageWidth;
                if (stage.stageHeight < 400)
                    SCREEN_SIZE_H = 400;
                else
                    SCREEN_SIZE_H = stage.stageHeight;
                mc2.width = SCREEN_SIZE_W - 100;
                mc2.height = SCREEN_SIZE_H - 100;
                mc2.x = SCREEN_SIZE_W / 2;
                mc2.y = SCREEN_SIZE_H;

  • 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.

  • Flash CS4/AS3 - How to use a preloader with FLVs?

    Somehow I've had a really hard time finding a straightforward forum answer or tutorial for this--maybe someone can help?
    I have an SWF file that references/loads an external FLV file (www.44designs.com/promo_video.php), but since the FLV file is about 9MB and can take time to load on a slower connection, I think a preloader (something simple like "LOADING...100%") would be a good idea as the FLV loads.
    Anyone have a simple way to do this??  I've had no success in finding what I need--just scripts for loading SWFs.  You can see an example of this on www.44designs.com where a preloader script I've got seems to be referencing the SWF (thus loading almost immediately) instead of the much larger external FLV.  Make sense?  I'm not super AS3 savvy, but I can follow logic and cut and paste

    Great info, thanks for the post!

  • Help! - as3 IE preloader issues

    Ok,
    So, I work for the NPS, and they have an outdated CMS. I have no rights  to upload an .html file, or edit one that the CMS makes.
    SO, I am forced to use their little deal to display my .swf files.
    Problem:
    http://www.nps.gov/glca/photosmultimedia/ehikes.htm
    I made an eHike in as3 Flash CS4. It has two scenes, the first scene is  the preload, second is splash content and ehike content. The problem is I  cant get the preloader to display in IE. I have all actionscript  content exported to the second frame, as talked about here:
    http://www.senocular.com/flash/tutor...preloaderstart
    and it works fine in firefox.......
    GRRRR....
    I have tried many different ways to load the preloader..... Here is what  I'm currently using....
    there is a simple text field for the percentage, and a simple 100 frame  animation. preloader_mc
    stop();
    var preLoaderPercent:Number = 0;
    addEventListener(Event.ENTER_FRAME, loadComplete);
    function loadComplete(e:Event):void {
        if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal) {
        removeEventListener(Event.ENTER_FRAME, loadComplete);
        this.loaderInfo.removeEventListener(Event.COMPLETE, loadComplete);
        this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadProgress);
        gotoAndPlay("splash", "content");
    }//loadComplete
    this.loaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
    function loadProgress(e:ProgressEvent):void {
        preLoaderPercent = e.bytesLoaded / e.bytesTotal;
        load_txt.text = Math.ceil(preLoaderPercent * 100) + "%";
        var animstop:Number = Math.floor(preLoaderPercent*100);
        preloader_mc.gotoAndStop(animstop);
    The CMS lets you decide in the popup window if it is resizeable or not.  This works in IE (stopping people from resizing), but not in firefox,  people can resize it. Is there any way to disable the resize in AS3?  Again, I understand that your supposed to export the .html file with  these settings, but I have no permissions to upload or create new .html  files.
    Anyone who will help me with this - Thanks
    David

    The problem is talked about here:
    http://stackoverflow.com/questions/460677/serving-raw-swf-files-displays-in-firefox-but-no t-in-ie
    Solution was to preload with an external .swf
    Cheers

  • Cs4 as3 preloader

    Hi,
    Is there a surestarter preloader in AS3 with CS4? Meaning here, showing a progress bar or percentage value before loading the main swf, right away at the start of the  loading.
    I tried 3 different versions:
    1- I used the code from a video (and accompanying files), and simply changed the content.swf to my own swf file (rename my swf content.swf), so that the original code would load my swf instead of the original content.swf. (original content.swf was too small to see anything before loading, because my loading speed is too fast).
    Here is the code from the original preloader (loads a small swf which then loads the main swf file):
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    l.load(new URLRequest("content.swf"));
    function loop(e:ProgressEvent):void
    var perc:Number = e.bytesLoaded / e.bytesTotal;
    percent.text = Math.ceil(perc*100).toString();
    function done(e:Event):void
    removeChildAt(0);
    percent = null;
    addChild(l);
    and here is the link to the file:
    http://www.raidcanada.com/preloader-org-test.html
    2- used the code suggested, which does the preloading directly in the main swf file:
    stop(); 
    //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.gotoAndPlay(2);
    This one doesn't work either, and if you refresh the page, you get only the bar, instead of refreshing the main swf.
    http://www.raidcanada.com/test/test-2.html
    3- use the code suggested to replace the preceding version:
    stop();
    addEventListener(Event.ENTER_FRAME,checkLoad);
    function checkLoad(e:Event):void {
    var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100;
    lbar.scaleX=pcent/100;
    lpc.text=int(pcent)+"%";
    if (pcent==100) {
    removeEventListener(Event.ENTER_FRAME,checkLoad);
    this.gotoAndPlay(2);
    This one loads correctly (without the percentage or progress bar) and the refresh is OK.
    http://www.raidcanada.com/test/test-1.html
    The idea is to have this page load correctly showing a percentage sign and a progress bar until the loading is complete for this page:
    http://www.raidcanada.com/entete-multi-hiver-1-test.html
    Every time I test the swf directly in Flash CS4 with the simulated download, I get the progress bar and percentage correctly.
    I also tried with Firefox and get the same results.
    FLAs are at:
    http://www.raidcanada.com/test/test-1.fla
    http://www.raidcanada.com/test/test-2.fla
    and screenshots of FLASH (showing the progress bar in "test movie" with simulated download):
    http://www.raidcanada.com/test/screenshot-test-1.jpg
    http://www.raidcanada.com/test/screenshot-test-2.jpg
    Am I missing something?
    THank you in advance

    Hi,
    I am using Internet Explorer 8, version 8.0.7600.16385 with Windows 7 Ultimate or Firefox 3 version 3.5.9
    If I flush the cache and load the page:
    http://www.raidcanada.com/entete-multi-hiver-1-test.html
    It takes about 5 seconds with a blank screen before I get the main swf displayed.
    If I load the page: http://www.raidcanada.com/test/test-1.html
    It takes about 1 second with a blank screen before I get the main swf displayed. The main swf file is much smaller.
    I also did a lot of tests, and still the same problem. Temporarely, on the production site, I ended up installing a static Image saying "Loading", without the code, which then loads the large swf. But some customers are seeing the "Loading" for 14 sec to 24 seconds, depending of the swf file.
    I know the code suggested is probably working with CS3 and AS2, but I need to make it work with CS4 and AS3, because my other code is all in AS3, built with CS4. As I said before, if I make a simulation, the simulation is perfect.
    Thanks

  • Flash CS5 AS3 Preloader Issues

    Hi.
    I'm a complete novice with Flash and at risk at looking like 'Dumbest Poster of the Year', I'm requesting help/advic over a couple of issues.
    My first concern is with a very simple preloader I've made for a movie. Here is the code (posted in first frame of movie; nothing else is in the frame except for the preloader itself):
    import flash.events.Event;
    stop();
    addEventListener(Event.ENTER_FRAME, loaderF);
    function loaderF(e:Event):void{
    var toLoad:Number = loaderInfo.bytesTotal;
    var loaded:Number = loaderInfo.bytesLoaded;
    var total:Number = loaded/toLoad;
    if(loaded == toLoad) {
      removeEventListener(Event.ENTER_FRAME, loaderF);
      gotoAndPlay(2);
    } else {
      PreLoader.PreLoaderFill.scaleX = total;
      PreLoader.PercentLoaded.text = Math.floor(total*100) + "%";
    When I simulate a download, the preloader works fine in all the settings except for 'T1'. On this setting, the movie loads to about 20% then the preloader stops, the movie begins and I receive the following error message in the output panel:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at FlashFront1_fla::MainTimeline/loaderF() .
    The movie itself plays fine on all settings, including 'T1'. Debug doesn't report any issues on preloader or movie.
    Can anybody give me any idea what the source of the issue is? Should I even be concerned about it givne that the movie plays without a problem?
    My second question relates to the 'Simulate Download' pre-settings in Flash. I know their are people out there still on 56K dial-up, or with 'broadband' running at 500 KBS (in the UK at least), but nevertheless, the download simulation settings seem like they are all geared to internet as it was in 1997 and are hardly reflective of the capacity of modern connections. Why is this?
    My movie is not large (about 320KB). Should I even be bothering with a preloader or am I wasting my time for a small minority audience (much like the web designers who still produce sites for the 12 people in the world still browsing in 800 x 600 res)?
    Thanks for any help/advice.

    Flash movies stream down and finish "loading" when the first frame and content that loads on the first frame is available, though frame 1001 might not be downloaded yet. You would think you'd be kinda safe with frame 2 on a T1, but I think the issue is things aren't updating in the right order  rather than things not really being downloaded. Heck, it could even just be the T1 simulation that's causing problems.
    Debug Movie probably isn't showing issues because it slows the timing enough to make everything ok. You could try trace statements too to see how far the code gets.
    Also, you might try a full scale AS3 loader like this one http://www.republicofcode.com/tutorials/flash/as3loader/
    I've found the Event.COMPLETE listener for the loader like this:
    my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
    to be pretty accurate so far in regards to content truly being loaded where as previous methods gave false positives for loading.

  • Pure AS3 self-preloader

    My project originally had everything on the timeline, but I have since moved all the code to the document class, but some of my assets are still in the library and some of them are embedded. I'm trying to make a self-preloader that doesn't use any external files, but I can't seem to find a good tutorial that doesn't involve using the timeline. Can anyone point me to a pure AS3 self-preloader tutorial or tell me where I'm supposed to put everything?

    If you mean by "self-preloader" a pure Standalone as3 preloader:
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    //this line has to be adapted to the name of your document class
    l.load(new URLRequest("main.swf"));
    function loop(e:ProgressEvent):void
        var kBytesLoaded:int = Math.round(e.bytesLoaded/1024);
        var kBytesTotal:int = Math.round(e.bytesTotal/1024);
        var perc:Number = kBytesLoaded / kBytesTotal;
        trace("PERCENT:"+perc);
    function done(e:Event):void
        //this line for the stuff you might need to visually communicate the loading process and want to remove when loading is done
        removeChildAt(0);
        addChild(l);

  • Preloading in the swf itself AS3

    Hello guys ;]
    I need some help in AS3.
    My problem is that I can't preload the content in the swf
    movie itself.. I mean movie clips and images that are inside the
    swf not external and so on.
    In AS2 All I needed to do is this :
    this.onEnterFrame = function() {
    loadingAmount =
    this.getBytesLoaded()/this.getBytesTotal()*60;
    if (loadingAmount == 60 and sVars.loaded == true and
    this.bigPicWidthsScript_mc.wVars.loaded == true) {
    this.gotoAndStop(3);
    delete this.onEnterFrame;
    This is juat an example what used to work.. I copied this
    part from a code I wrote time ago in AS2.
    So all u had to do is put this code on frame 1 along with
    some preloading graphics (small size), move all your movie clips u
    want loaded before they actually show up and start your animation
    to frame 2 as keyframe, and Put the ones who show up at the start
    in your movie at frame 3 where you actually go when preloading is
    finished.
    So I want to do the same thing in AS3.. I've found tutorials
    about preloading swfs images and so on but I don't need that.. I
    need this one here.. so does anyone have any idea how to do that ?
    I will be very grateful !
    Waiting for replies,
    Filip Nedyalkov
    Also u had to set Export frame for classes = 2 (in the
    publish settings),

    The reason you need it is because you are using the .text
    property on a member of the _root object. (I'm guessing but it
    wouldn't surprise me).
    About the import statement
    This is a personal philosophy and I'm open to valid
    suggestion here but the Flash Player looks at your code and builds
    a list of all the different classes that will be required at
    run-time and need to included in the compressed swf. If you an
    import like this....
    import flash.display.*;
    you are in theory including all of the classes inside of the
    flash display package. This is not actually the case. Even if you
    include the entire package in your code, all you are actually doing
    is telling Flash that this path/package is available for searching
    for the classes you are using in your document. Flash is only going
    to include a list of "necessary" classes when it runs its compile
    for your swf so keep that it mind. It is actually better to include
    the entire package set in my opinion thus playing it safe.
    It is a known bug and issue with preloading code inside
    IE6(7?) that prevents any kind of update being pulled from the
    browser concerning a files download. I've only had this issue in
    IE7 myself but this doesn't affect me or work since I typically
    only use the top level of a swf as a container for individual swfs
    which I load in using the Loader class. You can read more about the
    problem here (leads off to Actionscript.org forums with related
    post on topic)...
    http://pixelfumes.blogspot.com/2007/07/ie6-as3-preloader-events-failing.html

  • 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);

  • HELP: Preloader and Button AS3

    Hi guys!
    I used to work on AS2 to make my animations, buttons and portfolios, but now I needed to use AS3 to make some forms interact with some PHP script.
    TextInputs and Buttons on COMPONENTS are working and interacting normally with PHP. My PreLoader is working great too. But what should the easiest is not working: MY SIMPLE BUTTONS! It used to be so easy in AS1 and 2, but now on AS3 it's not working. I am putting all my action and codes in a ACTIONS FRAME in the top of my animation, but it is not working!
    I have my Preloader on my frame 1 working, calling my animation on frame 2. The code is here (it's working):
    stop();
    addEventListener(Event.ENTER_FRAME, loading);
    function loading(event:Event) {
    var bytestotal = stage.loaderInfo.bytesTotal;
    var bytesloaded = stage.loaderInfo.bytesLoaded;
    var sclbar = Math.round(bytesloaded*100/bytestotal);
    custom_animation.gotoAndPlay(sclbar);
    if (bytesloaded >= bytestotal) {
    removeEventListener(Event.ENTER_FRAME, loading);
    removeChild(custom_animation);
    gotoAndPlay(2);
    Then I placed my buttons actions on the frame 2.
    If I use the action:
    home_btn.addEventListener(MouseEvent.CLICK,clickHome);
    function clickHome(evt:MouseEvent):void {
    gotoAndPlay(2);}
    release_btn.addEventListener(MouseEvent.CLICK,clickRelease);
    function clickRelease(evt:MouseEvent):void {
    gotoAndPlay(2690);}
    My movie pauses and no action is added to my buttons.
    I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at index_Scene1_fla::MainTimeline/frame2()
    If I use the action:
    addEventListener("addedToStage", oas);
    function oas(ev){
    init();
    home_btn.addEventListener(MouseEvent.CLICK,clickHome);
    function clickHome(evt:MouseEvent):void {
    gotoAndPlay(2);}
    release_btn.addEventListener(MouseEvent.CLICK,clickRelease);
    function clickRelease(evt:MouseEvent):void {
    gotoAndPlay(2690);}
    The movie plays complete, but I get no actions in buttons and a error in my components textinput and button (they look like shaking).
    I get this error: 1180: Call to a possibly undefined method init.
    I tried to use the import flash.display.SimpleButton too, but it doesn't work too.
    Anyone could help me????
    Thanks,
    Pedro

    If you can provide a clear explanation of where the buttons are and where the code for them is located that might help lead to a solution.  From what you have described already it is not clear where the code is and where the buttons are.  You should not have to use an init function if you are doing so to wait for the buttons to be loaded... they are already loaded when you get wherever they are.
    For the 1009 error, it is indicative of the object targeted by your code does not exist in theframe where that code is.  SO if you have your code on frame 1 and your buttons are in frame 2, that would account for that error, as well as a few other possible scenarios.

  • Preloader (from as2 to as3)

    Hey ladies and gentlemen
    I'm currently converting one of my project to as3 and I hit a
    wall with this preloader problem.
    Before, with as2, I was using getBytesLoaded() and
    getBytesTotal() in a frame loop to display a progress bar and know
    when the loading was finished. I can't seem to find how to do this
    in as3.
    I read as3 language reference and some examples but they all
    deal with loading an external swf or file.
    I would think that the main swf would trigger progress events
    as it gets loaded so I made this little piece of code, which
    doesn't work.
    function ProgressHandler(theEvent:ProgressEvent)
    trace("bytes Loaded: " + theEvent.bytesLoaded + "
    bytesTotal: " + theEvent.bytesTotal);
    addEventListener(ProgressEvent.PROGRESS, ProgressHandler);
    stop();
    Can anyone point me back in the right direction?
    Thanks

    I just wanna make it clear that I'm trying to preload the
    main swf itself, I still can't find anything on the net about that.
    Anyone?
    Thanks!

Maybe you are looking for