The external preloader doesn't wait?

Hello! I have a new dilemma concerning external preloaders.
Now I found out that sometimes external preloaders don't wait to load the entire swf file before this last one runs.
I read a few tutorials, specifically this: http://sierakowski.eu/list-of-tips/45--two-ways-of-preloading-in-actionscript-3.html.
I understood the concept and I applied both explained methods, but still couldn't find a solution: the swf file runs before the preloader finishes to load.
Can anybody help me?
This is my code (useless) so far:
import flash.display.MovieClip;
var myLoadedMovieClip:MovieClip;
var contentLoader:Loader;
loadContent("Index11.swf");
function loadContent(url:String):void
    contentLoader = new Loader();
    contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading);
    contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
    contentLoader.load(new URLRequest(url));
function contentLoaded(evt:Event):void
    myLoadedMovieClip = MovieClip(contentLoader.content);
    myLoadedMovieClip.play();
    removeChild(progressbar);
    addChild(myLoadedMovieClip);
function loading(evt:ProgressEvent):void
    var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
    setBarProgress(loaded);
function setBarProgress(value:Number)
    progressbar.bar.scaleX = value;
    contentLoader.visible = true;

Thank you Kglad!
Thanks to your questions, I realised there wasn't a problem with the code you gave me at all.
It was MY problem. I got confused and I should be more systematic and organised with my files.
Now everything works fine.
I leave the code properly written, in case anyone needs to see it:
from the External preloader:
import flash.display.MovieClip;
var myLoadedMovieClip:MovieClip;
var contentLoader:Loader;
loadContent("Index11.swf");
function loadContent(url:String):void
    trace("start load");
    contentLoader = new Loader();
    contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading);
    contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
    contentLoader.load(new URLRequest(url));
function contentLoaded(evt:Event):void
    trace("loaded");
    myLoadedMovieClip = MovieClip(contentLoader.content);
    myLoadedMovieClip.play();
    removeChild(progressbar);
    addChild(myLoadedMovieClip);
function loading(evt:ProgressEvent):void
    var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
    setBarProgress(loaded);
function setBarProgress(value:Number)
    progressbar.bar.scaleX = value;
    contentLoader.visible = true;
And in the swf file:
first frame (with blank keyframes in the timelines):
stop();
trace("frame",1);
second frame:
trace("frame",2);
my url is: http://gabrielates.com/
Thanks again!

Similar Messages

  • The external keyboard doesn't react

    The external keyboard doesn't react anymore. At first only some keys, now the whole system is blocked. What can I do?
    Werner Schmitt

    The external keyboard doesn't react anymore. At first only some keys, now the whole system is blocked. What can I do?
    Werner Schmitt

  • Using Mac OS on multiple monitor is great, but after removing external monitor (2nd monitor) usually windows position originally on the external monitor doesn't get re-positioned to default monitor. Is there any shortcut key or utilities that can reset wi

    Using Mac OS on multiple monitor is great, but after removing external monitor (2nd monitor) usually windows position originally on the external monitor doesn't get re-positioned to default monitor. Is there any shortcut key or utilities that can reset wi

    Got the "apple firewire ntsc" choice to show up even if grayed out and "missing" under "audio/visual" menus by recreating choices in Easy Setup under "final cut pro" MENU thank GOODNESS because I was reading horror stories on here about this under another thread with someone trashing preferences, reinstalling and the works and still not getting it to show up...on my search now for an analog/digital converter up at b&h...find it odd that the s video connector wouldn't show the crt monitor when I put both displays through the 3870...I switched it back to see if it worked again when only the one dell monitor display was there and there it is again mirroring the screen display on my desktop...just can't be seen as an "external monitor" in fcp...couldn't find anything specific in the shane ross threads to this. I'm sad the program doesn't just see the s video connection though the 3870 though my computer does fine and will query up at b&h in regard to what might be affordable as far as a digital/analog converter. It's also weird in itself that when I put the two dell monitors on the one card my computer no longer could see the s video crt connection...makes no sense. Will report in later as to what I discover up at b&h as I'm sure there's a world of people out there using this sony crt monitor still even into the upgrades with computers and software so I imagine therein lies the solution. Thanks again and I'll report in as to what hardware might be suggested for me.

  • ITunes lost all of my files on the external drive, thousands of songs.  Is there a way to load them back in without doing one at a time?

    I've just updated the lates iTunes, and now it seems to have lost all of my music.  I have thousands of songs on an external drive, none of them can be found...the songs are in multiple folders on the external drive so the media folder to the external folder doesn't fix the problem...iTunes isn't seeing songs that are in different folders with sub folders.  Is there a way to have iTunes discover the music on the external drive to avoid reloading each of them one at a time?

    When you first download iTunes onto a PC, it will give you the option to allow iTunes to search for your music. I'd suggest removing iTunes from your PC, connecting your external drive and then download iTunes from scratch. I'm pretty sure if you let it, it will find the music for you.

  • Full browser external preloader

    I have a preloader and on completion it loads an external .swf. My external swf has full browser actionscript. How can I get the external PRELOADER to load the external swf and retain its full browser settings?
    This is my preloader actionscript:
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    l.load(new URLRequest("tester.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);

    I did that, the external swf still loads at the movie size as opposed to the full width/height of the browser

  • Mac won't boot, stuck on grey screen if the external hdd plugged in

    as the title.
    if i plug my external drive, via usb port, the mac won't boot and stuck at grey screen.
    unplugging it, the boot process will continue.
    the hdd is a LaCie mobile hdd
    any help?

    Hello jason(?)
    It's a LaCie external mobiel hdd, formatted as exFAT. without adapter. take power directly from usb port.
    i tested it on my iMac and it works fine. boot up as normal. the only difference is my iMac is on 10.6.8 and my Air is on 10.7.2
    I tested on both USB port on my Air and the problem still persist.
    the read/write speed is normal (bought it like a day ago).
    another thing is I don't have this problem with my external WD drive.
    One thing to notice is that, I accidentally left like for like 2-3 mins and it boots. So why the question now is why it's taking so long to boot? normally it just takes <20 seconds. Seems like it tried to boot from the external hdd, doesn't it?

  • Music begins playing before my external preloader is complete. Can anyone help?

    Hi, I'm hoping someone can help with this. My code for the external preloader is below: (not sure why the odd boxes are showing up)
    function launchSWF(vBox, vFile):void{
    var swfLoader:Loader = new Loader();
    //vBox.addChild(swfLoader);
    var swfURL:URLRequest = new URLRequest(vFile);
    swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
    swfLoader.load(swfURL);
    function loadProdComplete(e:Event):void {
    trace("swf file loaded");
    vBox.removeChild(preLoader);
    vBox.addChild(swfLoader);
    currentSWF = MovieClip(swfLoader.content);
    currentSWF.gotoAndPlay(1);
    currentSWF.addEventListener(Event.ENTER_FRAME , checkLastFrame);
    function checkLastFrame(e:Event):void {
    if (currentSWF.currentFrame == currentSWF.totalFrames) {
         currentSWF.stop();
        // trace("DONE");    
    var preLoader:loader = new loader();
    preLoader.x = 345;
    preLoader.y = 340;
    vBox.addChild(preLoader);
    function onProgressHandler(event:ProgressEvent){
    var dataAmountLoaded:Number=event.bytesLoaded/event.bytesTotal*100;
    preLoader.bar.scaleX = dataAmountLoaded/100;
    preLoader.lpc.text= int(dataAmountLoaded)+"%";
    trace(preLoader.bar.scaleX );
    var container:MovieClip = new MovieClip();
    var swfFile:String = 'WashingtonGas.swf';
    var currentSWF:MovieClip = new MovieClip();
    launchSWF(container, swfFile);
    //put it on stgae
    addChild(container);
    Thank you!

    I think the problem is that my as3 knowledge is too limited for me to do anything other than directly follow a tutorial, use code snibbets, etc. I'm feeling like this should be easy but even with your suggestions, its not coming together, unfortunately.
    When I add the sound via actionscript, it still loads too early and I also then can't figure out how to turn it on/off with the button I have in the swf. When I add a simple play(); and stop(); it only stops my animation in the swf. Here is my working url in case that sparks anything!
    http://www.rowhouseco.com/WashingtonGas/

  • They sent me a serial number for a windows version of PS Elements when I ordered a mac version.  The serial number doesn't work, not surprisingly, but they don' t seem to care.  I have tried the chat line and have waited for almost a day with no response.

    They sent me a serial number for a windows version of PS Elements when I ordered a mac version.  The serial number doesn't work, not surprisingly, but they don' t seem to care.  I have tried the chat line and have waited for almost a day with no response.  What should I do?

    Look here
    Order product | Platform, language swap

  • I am using a T61 ThinkPad with an external hard drive and my itunes library keeps disapearing but remains on the external drive. Any idea how to fix this so my music doesn't disapear all the time? It's a real drag pulling music back into iTunes each week.

    I am using a T61 ThinkPad with an external hard drive and my itunes library keeps disapearing but remains on the external drive. Any idea how to fix this so my music doesn't disapear all the time? It's a real drag pulling music back into iTunes each week

    In iTunes 11 uncheck the preferences setting in in the iTunes Preferences panel "Advanced > Copy Files to iTunes Media folder when adding to Library"

  • HT4889 Migration Assistant to update my new Mountain Lion iMac from an external USB hard disk drive, it is constantly saying that it is "looking for other computers". It doesn't find the external drive. Why is it looking for other computers?

    I'm trying to use Migration Assistant to update my new Mountain Lion iMac from an external USB hard disk drive. I told it to look for a drive, yet it is constantly saying that it is "looking for other computers". It doesn't find the external drive ... it just endlessly looks for other computers. Why is it looking for other computers at all, when I told it not to?

    Wow, the wording in Migration Assistant is misleading. I've never used it before, so I thought I would try to copy my files from the external drive ... my old iMac died, but I managed to get everything I need off it, using the 'cp' command in single-user mode. So I guess I'll just have to manually copy the files from the external drive to the new machine. I was hoping that Migration Assistant might help somehow, but obviously not.
    Thanks for the quick reply!

  • Why the preloader doesn't work in IE 8 but works in FireFox?

    Why the preloader doesn't work in IE 8 but works in FireFox?
    Please see the attached files.  Thanks in advance.

    Why doesn't the preloader work in IE8?
    What's "virtual sandbox"?

  • PhotoShop external editor doesn't show up in Preset file application support. It is listed as the top external editor. But will not go there

    PhotoShop external editor doesn't show up in Preset photoShop file application support. It is listed as the top editor in the Light room preference. But it will not go there. You can use export to Photoshop CC but not as a editor. It stays there. I have OS10.8 and Photoshop CC not Photoshop CC2014 at this time. If I go to presets in Lightroom preferences and push restore export presets
    do I also lose my plugin presets and have to reload them ?

    Trakibounce:
    Glad you were able to resolve your issue. Thanks for posting back with how you did it.
    HAPPY HOLIDAYS!
    cornelius

  • Why setting the download folder ton an external HDD doesn't work? the downloaded files goes to My Documents (Windows)?

    Why setting the download folder ton an external HDD doesn't work? the downloaded files goes to My Documents (Windows)?

    I did what you said and updated FF, now the download goes to the external HDD that I specified, but now FF bugs, it freezes (not responing) :s
    I reinstalled it but it doesn't fix the problem. I don't know what to do :(

  • Ipod touch is trying to download a song from itunes and an app from the store. Both are waiting, and won't dowload. Is there a way I can stop them dowloading? Doesn't seem to be an option to

    My ipod touch is trying to download a song from itunes and an app from the store. Both are waiting, and won't dowload. Is there a way I can stop them dowloading? Doesn't seem to be an option to

    Create a iTune and App Store account without credit card
    1. Go to App Store and select a free app
    2. Tap INSTALL APP
    3. Create New Apple ID
    4. Confirm Your Country
    5. Agree with Terms and Conditions
    6. Fill in your Apple ID and Password (must be a valid email address)
    7. Create and answer your secret question e.g. What is the name of my dog?
    8. Select NONE for Payment Method
    9. Fill in Billing Address i.e. your address
    10. Submit application for new Apple ID
    11. Wait for verification email
    12. When email arrive, verify your account
    13. Start downloading your free apps

  • HT3131 Why doesn't Apple mention using the Display control panel's "Arrange" feature to move the menu from the Macbook's display to the EXTERNAL display? THAT'S the real answer to make Clamshell mode work, but it's not mentioned in any Apple documentation

    After a recent OS update, Clamshell mode quit working. I couldn't find any Apple documentation
    that would help. So many people were stabbing around in the dark, until I finally found the following information
    that is lacking from any Apple documentation that I've been able to find.
    Here's what I found to be the most helpful:
    Forcing a MacBook to use the External Monitor:
    I tried about everything: Rebooting, switching off completely, removing and inserting the Thunderbolt->HDMI adapter etc.
    The only thing that finally worked was the following:
    1. Take it out of the dock and connect to Power and HDMI to the TV.
    Shut down the Mac. Turn it on and close the lid. It will now boot up on the external screen.
    Log onto the Mac, and put it in sleep mode (Option-Command-Eject).
    Put it back into the dock and wake it up with the spacebar.
    It should be OK now... until the next update...
    Note: One indication that you’re going to have extreme trouble with this is when (occasionally and without reason) the Mirroring Options icon shows up on the top icon bar.
    Other useful commands:
    “Command + F1” puts PC in Two-Screen MIRROR mode.
    If it’s REALLY being stubborn, do the following (Clamshell Must be open
    to see the arrangement tab.):
    In System Preferences > Display on the MacBook screen there should be an Arrangement tab when you have the MacBook hooked up to the TV and both screens working. When you click the Arrangement tab do you see two monitors side by side? One of them will have a Menu Bar at the top. Just click on the Menu Bar and drag it to the second monitor (Yes, I know, it’s hard to grab ahold of it...) That will make your EXTERNAL monitor your main screen.
    You can now use your MacBook in Clamshell Mode with a wired or Bluetooth keyboard and mouse.  http://support.apple.com/kb/HT3131 When you disconnect from the TV, make sure it’s asleep (Option+Command+Eject buttons) or your Menu Bar will automatically change back to the MacBook.

    After a recent OS update, Clamshell mode quit working. I couldn't find any Apple documentation
    that would help. So many people were stabbing around in the dark, until I finally found the following information
    that is lacking from any Apple documentation that I've been able to find.
    Here's what I found to be the most helpful:
    Forcing a MacBook to use the External Monitor:
    I tried about everything: Rebooting, switching off completely, removing and inserting the Thunderbolt->HDMI adapter etc.
    The only thing that finally worked was the following:
    1. Take it out of the dock and connect to Power and HDMI to the TV.
    Shut down the Mac. Turn it on and close the lid. It will now boot up on the external screen.
    Log onto the Mac, and put it in sleep mode (Option-Command-Eject).
    Put it back into the dock and wake it up with the spacebar.
    It should be OK now... until the next update...
    Note: One indication that you’re going to have extreme trouble with this is when (occasionally and without reason) the Mirroring Options icon shows up on the top icon bar.
    Other useful commands:
    “Command + F1” puts PC in Two-Screen MIRROR mode.
    If it’s REALLY being stubborn, do the following (Clamshell Must be open
    to see the arrangement tab.):
    In System Preferences > Display on the MacBook screen there should be an Arrangement tab when you have the MacBook hooked up to the TV and both screens working. When you click the Arrangement tab do you see two monitors side by side? One of them will have a Menu Bar at the top. Just click on the Menu Bar and drag it to the second monitor (Yes, I know, it’s hard to grab ahold of it...) That will make your EXTERNAL monitor your main screen.
    You can now use your MacBook in Clamshell Mode with a wired or Bluetooth keyboard and mouse.  http://support.apple.com/kb/HT3131 When you disconnect from the TV, make sure it’s asleep (Option+Command+Eject buttons) or your Menu Bar will automatically change back to the MacBook.

Maybe you are looking for