AS3 Self contained preloader - bytesTotal 0bytes issue

Hi,
I wrote a really basic preloader class using loaderInfo to preload my main swf. Problem is, that loaderInfo.bytesTotal returns 0.
Does any one know how to handle this issue?
BR,
Kamil

package {
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageQuality;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.BlendMode;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.filters.BlurFilter;
import flash.system.Security;
Security.allowDomain("*");
public class Preloader extends MovieClip {
//preloading
public var loaded_bytes:Number;
public var total_bytes:Number;
public var percent:Number;
public function Preloader() {
//listeners
Security.allowDomain(loaderInfo.url);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
loaderInfo.addEventListener(Event.COMPLETE, onComplete);
loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
Preloading functions
private function onProgress(e:ProgressEvent):void {
loaded_bytes = e.bytesLoaded;
total_bytes = e.bytesTotal;
//if( total_bytes == 0 ) total_bytes = 1;
percent = Math.floor(loaded_bytes / total_bytes * 100);
private function onError(e:IOErrorEvent):void {
trace(e);
private function onComplete(e:Event):void {
stop();
trace("SWF Loaded");
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
      loaderInfo.removeEventListener(Event.COMPLETE, onComplete);

Similar Messages

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

  • Self Contained QT video issues

    I have a AVCHD video edited with FCP 6 and exported as a self-contained QT file.
    1. When watching the self-contained file, there seems to be wavy lines during parts of it when there is motion, however, as a self-contained QT file there should be no compression? What might be causing this?
    2. The exported file appears distorted when viewed in the QT player - faces seemed stretched, etc.
    Thanks for any help.

    however, as a self-contained QT file there should be no compression?
    Self contained means only that the file is independant of other media files. A Reference movie literally refers to other files or parts of files in order to exist.
    Using the FCP commands: Export > QuickTime Movie > Self Contained > Current Settings will produce a file without further compression, because it is made with the same codec as used by FCP's Sequence setting.
    As to the file you have, what settings does it use?
    Is the codec using interlacing? If so, where are you viewing it?
    Are you viewing it at 100% of its native size?
    Stetched vertically or horizontally?

  • Issue with Exporting video as Quicktime, Self Contained

    Hi, I am a new Final Cut Pro user, and a new Mac user really. I am taking a film editing class and we are required to capture and edit HDV footage into essentially a 2-3 minute edited video. So I completed the capture and editing, and my finished product came to about 2:15. My professor is requiring us to turn in the assignment on a flash drive. Problem is, my exported video lags/skips/pauses throughout the entire thing, especially when played on a flash drive. Also, I noticed the file size is abnormally large for a 2 minute video, clocking it at around 2.3 gig. I also noticed that it exports a bunch of source files as well, and the exported video won't play without them. However, I am 100% positive that I exported "as a self contained video." So shouldn't that mean the video should be able to play on its own, no strings attached so to speak?
    Something is just fishy about my video when I export it. All I want is a simple quicktime that should play without lag, and play on its own, but instead I get a huge video with all the source files, despite the fact that I checked the "self contained" box. Is there anything that stands out that I might be doing wrong? A particular sequence setting I should change? I'd greatly appreciate it.

    Hi -
    The reason that your video is playing back poorly is that a USB flash drive does not have the speed necessary to support playing back your movie. I am confident that the flash drive is just a way of delivering the file to your instructor, and that once delivered, they will transfer the mov file from the flash drive to a regular disk drive for playback.
    You can test this yourself right now by dragging the mov file from your USB flash drive to your hard drive and playing it from there.
    If it does not play correctly after having done that, post back.
    In regards to the having other source files on the drive, are you confident they were created when you exported your finished movie to it?
    What exact method did you use to export your movie - it should have been: remove all in and out points from the timeline, click on the sequence icon for the sequence you wish to export, go to the menu File > Export > Quicktime Movie and when the dialog box opens, make sure Make Movie Self Contained is checked, as well as Current Settings and Audio and Video, unless otherwise specified by your instructor.
    If it were me, I would export the mov to my hard drive, the copy that export to the USB flash drive, but it is up to you.
    The size of the resultant file is depends on the codec and frame size you used for the edit.
    Hope this helps.
    MtD

  • FCP quits when exporting ref movie or self contained

    This one has be pulling my hair out. When I try to export an hour long project, FCP quits about half way in. Doesn't seem to matter if it is a ref movie or self contained. I get the unexpectedly quit window. I have no idea how to fix this. It is extremely frustrating. Any ideas?
    Best.
    Tom

    Don't use an XDCAM sequence setting. Mixing that format with ANY OTHER FORMAT causes issues. I have had 3 jobs in the last 2 weeks that were HDV and XDCAM, and when they were in their native timeline settings, with other footage and graphics mixed in, I had HORRID times exporting and outputting. The solution? Changing the sequence compressor to ProRes, and rendering again. Then the projects exported fine.
    So my rule #1 when dealing with HDV or XDCAM, is to edit in a ProRes sequence...all the time. No matter what. Dealing with GOP native, when you add other things like stills or other footage, is cause for nightmare issues. That GOP format is just too whacky to deal with.
    Shane

  • Exporting self contained quicktime

    I'm fairly new to compression. I've noticed alot of comments saying not to export to compressor from the timeline in FCP, but to export a self contained quicktime. Then encode in compressor.
    Doesn't this A)take more time as your exporting twice
    B)take up alot more space.
    Is it just a compression time issue or do you get better quality results when exporting the self contained QT first.
    Thanks

    Overall you get better quality
    A)take more time as your exporting twice
    Can be a bit more time, but worth the results. Generally I find that it is faster to some degree, exporting from Final Cut to Compressor gets slow from rendering and feeding the frames in. Also if you want to tweak the encoding rates after the first encode, having the self contained movie will be faster
    B)take up alot more space.
    It does take up more space, but it is definately worth getting an extra drive to do this, really worth it because of the quality, potential reencodes, etc.

  • Self contained movie or FCP sequence to proper encode Dolby 5.1.

    Hi everyone,
    I made a test to produce an AVCHD Blu-ray (to be burnt on regular DVD5) disk with Dolby Digital Surround 5.1, using Compressor 3.5 and FCP 7.
    FCP timeline was having 6 individual audio tracks in the proper order to assign each channel to the speakers once encoded and burnt into DVD; also the sequence was set to produce 6 outputs.
    My first trial was to export a QuickTime self contained movie in FCP7, using current settings for audio/video.
    Then I imported it into Compressor and I noticed in the inspector that audio was listed as PCM little endian 48KHz.
    I applied my target for H.264 video and Dolby 5.1 for audio.
    When I tested the DVD on my Blu-ray player+Dolby 5.1 receiver, the sound was mixing improperly with the speakers.
    So I tried in a different way thinking that the source QT movie might have been the issue: this time from FCP7 I used "send to compressor", in order to import directly the timeline.
    In this case, in compressor, the inspector revealed the audio to be 5.1 channels and after encoding and burning the DVD (with same exact settings), this time the DVD played nicely with the audio sent properly to the speakers.
    So, I guess, either I made a mistake in creating the initial QuickTime MOVIE or there was an issue for compressor to properly understand that the movie was containing 6 audio outputs.
    I have checked the QT MOV using QT player and the inspector: it was listing 6 instances of distinct audio tracks PCM little endian 48KHz.
    Did anyone else note this behavior?
    Regards,
    Armando.

    Hi Rick,
    when I was working with a QT movie export from FCP, in one case I had been working with 6 individual mono AIFF files (created with Soundtrack Pro) in the timeline, each assigned to the proper output channel.
    Even though when getting into Compressor I could see it was going to fail, as by checking the inspector I was always seeing the source audio listed as PCM little endian.
    Only when I was working directly with the FCP timeline (using the "send to compressor" from FCP menu) I saw in Compressor's inspector the proper audio info as 5.1 channels; then the final export worked fine.
    So I guess you could see this even without getting to the end of the process whether your final work will be good or bad.
    At the end it doesn't bother me at all using the "send to" command when I have to create this Dolby 5.1 kind of movie... the thing is that I didn't find any mention of this in the documentation.
    Regards,
    Armando.

  • Make Movie Self-Contained option

    I edited some video at home and wanted to bring it to work so I can bring it into DVD SP. I selected File>Export QT Movie and chose Current Settings, it was captured as DV NTSC. I also checked make movie self-contained.
    1. Is the idea behind this so I will end up with one file that will not need to reference any of the media or project files on the computer it was captured, so it can just be taken with me?
    2. I tried several times to copy the 8GB QT file to an external drive, and close to the end of the process I receive the following error:
    Sorry, the operation could not be completed because an unexpected error occurred (Error Code -1309).
    It then continues copying for a few seconds and just stops and nothing ends up on the external drive. I tried rebooting and unplugging the drive and tried again with the same results. Any ideas why it is doing this? Is this a Tiger issue or an issue with my settings in FCP? I even unchecked Make Movie Self-Contained and it still had the same problem when I tried to copy it.
    Thanks!!!

    If the windows system recognized the drive when connected, and you weren't running a special app like MacDrive on the Windows system, then the drive isn't formatted as Mac OS extended (aka HFS+). It's more likely that it's formatted as FAT 32 since you've used it before to read/write files to and from your Mac. A FAT 32 drive when connected to a Mac will limit file size to 2gb.
    -DH

  • Save as self-contained movie option no working in browser downloaded video

    HELP!!!!!
    Today my QuickTime Pro 7 option arrow to save browser downloaded videos as self-contained movie has stopped functioning. Any suggestions?
    Thanks.

    +I've found mov's to be substantially larger in size than wmv, but I can't really explain why, other than compression being the factor.+
    MOV files are a container format, not a compression format. Also, when saving as a self-contained MOV, it simply repackages the file with the same encoding, so this problem is independent of compression issues.
    +You can also get on the F4M user forum+
    Yes, that was going to be my next step. I posted the question there, and they said the increase in size is a side effect of making the WMV compatible with the MOV format. It has something to do with ASF packetization.
    http://forum.flip4mac.com/forum/messageview.aspx?catid=10&threadid=1439&forumid= 1
    To get around this problem, I guess I'll just have to recompress all the files in some other (non-WMV) format.

  • Exports as self-contained when self-contained box not checked

    When exporting from FCP 7 using QuickTime movie, sometimes I get what appear to be a self-contained movie even though I did NOT check the box for that. That eats up a lot of file space unnecessarily. By way of example, today I exported two separate sequences from the same project. Both sequences were about the same length. Both sequences consisted of clips that were 1920 x 1080 .mov files. Both sequences had chapter markers. Both exports were done leaving the "Make Movie Self-Contained" unchecked. Yet one of the exports resulted in a file of about 1GB while the other was about 13GB. Any explanation? Thanks.

    Thanks for the reply and sorry about being in the wrong forum but I was having trouble finding the forum for FCP7. In any event, the exporting issue doesn't appear to correlate with the project having been fully rendered. I'll keep investigating.

  • Exporting self-contained from DVCPRO HD is Stuttery

    I have my DVCPRO HD timeline (720p). When I export using "Quicktime Movie", select "Current Settings", and check mark "make movie self-contained", The resulting movie is a bit stuttery compared to my original timeline. Almost as if I was watching a bad conversion of 23.98 to 29.97 timebase. The weird thing is that some shots are smooth, but it could just be my eye :S. Is this stuttering occuring due to the re-compression process of making a self-contained movie?
    How would I be able to export a quicktime movie without the stuttering? Would I have to use "Quicktime conversion"?
    EDIT: "Recompress all frames" was NOT CHECKMARKED!! Maybe I should checkmark it?

    Theoretically, DVCPRO HD 720 should play back off a FW drive.
    But if I had a dollar for every issue with shared bandwidth between firewire drives and camera/decks on a single firewire bus Mac.
    Others may disagree, but I strongly urge that you:
    1. dedicate an internal SATA drive for media
    2. Or use a SATA PCI controller and external 2/4 drive SATA enclosure.
    Don't know what your camera is, but if you're working in PROHD, it's at least a HVX200.
    Throughput is 4 times the overhead as DV.

  • Audio drift on FCP self-contained movie output

    I just output a 25 minute show as a self-contained FCP QT file, which I was was then going to throw into Compressor. The exported QT file started experiencing audio drift at about 7 minutes, and it looks like it's about a second off by the end of the show.
    In FCP, the sequence is in sync, al the way through the end. The sequence is 1920x1080 XDCAM 24p.
    I've never had this happen in a self-contained movie, and ideas what could be happening here?
    Thanks,
    Patrick
    Message was edited by: P.N. Barnes
    UPDATE: It looks like the audio may be off by the same amount starting at one point in the QT file through the rest of the show.

    Is the total duration of your sequence and your exported QuickTime movie exactly the same?
    I have seen FCP actually skipping frames on export of XDCAM HD422 sequences.
    Try importing your self-contained QuickTime movie and put it on a video layer above your original sequence. Zoom in at the end of your sequence and see if the total duration matches up. If not, you know you have issues with frames getting skipped on export to QuickTime Movie. If you look closely in the QuickTime Movie file you might even notice by looking at the timecode in QuickTime Player that certain frames are skipped. It is possible to spot these areas by looking for places with motion where you easily can see any jarring jumps caused by frame skipping.
    Here is a possible workaround. Copy the clips from your XDCAM HD sequence, paste them in a ProRes HQ sequence and export a QuickTime movie of that. It might also help just deleting all render files before exporting. Seems like FCP (or rather the XDCAM HD codec) gets confused by the render files on export when calculating the new GOP structure.

  • Self Contained Final Cut Pro Export Files unreadable in New Final Cut Pro 7

    Has anyone come across this? I was using Final Cut Pro 5, created a self contained file of a current project 1.9GB in size. Uploaded the new version of Final Cut Pro 7 and upgraded to Snow Leopard, and now it tells me that this is unrecognizable as a movie file. Quicktime or Final Cut Will not open this file. I'm puzzled.

    VideoJunkie88 wrote:
    Has anyone come across this? I was using Final Cut Pro 5, created a self contained file of a current project 1.9GB in size. Uploaded the new version of Final Cut Pro 7 and upgraded to Snow Leopard, and now it tells me that this is unrecognizable as a movie file. Quicktime or Final Cut Will not open this file. I'm puzzled.
    Hi VideoJunkie
    I have not come across this. However, my previous FCP 6 Self-Contained Exported ProRes 422 standard (not HQ) files which are actually 1440 x 1080 will only playback in the new QT version 10 using that aspect ratio (whatever the actual screen ratio is at 1440 x 1080, I'm not sure, but the video width is squashed together... I suppose it has something to do with showing it in square pixels versus rectangle... or do I have that turned around. I'm not sure, I have always been confused about the ProRes 1440 x 1080 format, all I know is it plays back properly in 1920 x 1080 when I transcode it for DVD or ATV, iPhone etc..). In any case, you need QT player 7 (standard or pro version) to display these files at the intended aspect ratio of 1920 x 1080. The old QT Pro player version 7 will let you change this in the properties window, but the QT 7 standard player will not let you (those options are grayed out) and the new QT X player doesn't even show these options (i.e totally unavailable).
    Also, these previous files will play just fine (for me anyway) in FCP version 7. If you having a different issue where they will not play at all, then I'm not sure how to help you, but I just wanted you to be aware that my old self-contained files from FCP 6 do work (for me anyway) in the new FCP7 under Snow Leopard.
    (ADDED) I must ask, what codec were your previous exported self-contained QT movies? Do you have this codec on the commuter your trying to play your old master self-contained exports on?
    Ron
    Message was edited by: videocrafter

  • Why is DVD SP4 creating a corrupt video in the timeline when the corruption does not appear in the imported Quicktime ProRes 422 self contained movie?

    I am having a strange issue that just occurred when trying to create a DVD using DVD Studio Pro 4. The workflow is as follows: Import a self contained Quicktime ProRes 422 as an asset into DVDSP 4. Drag the assets onto Track 1 in the Graphical viewer as a First Play item. The video is only corrupted in a section of the timeline, yet when you look at that section in Quicktime the video appears to be ok. Does anyone have an idea why this is happenning?

    Thanks for the quick reply Gary. I was wondering why this corruption happenned recently, when I have used this workflow previously without any artifacts for several years. Do you think that something has gotten corrupted in DVDSP?
    Do you also recommend using Compressor always to created the files for DVDSP vs. having DVDSP do the encoding?
    Thanks

  • NOT Self-Contained workflow from FCPCompressorDVDSP

    Can I export a project NOT Self-Contained (audio only + video only ) then import it to Compressor and export again for DVDSP ? I want to save time and space.
    Is it faster using a project that is NOT Self-Contained in COMPRESSOR ? I like to use DVD BEST QUALITY. A self-contained project a hour long takes 3h30 to compress ...

    Given the current bugs in Compressor and FCP Suite as a whole, it would be 'fastest' for you to export as a self-contained movie and then to bring that into compressor.
    Here are a couple reasons why:
    - Direct export from FCP to Compressor is EXTREMELY slow as compared to Compressor v.1 and FCP 4.5
    - Compressor's finished MPEG-2 file sizes when using VBR are highly unpredictable (sometimes way too small, or way too large when even using Apple's Presets) and would most likely require a re-encode to get your output file size correct. This is why I recommend working with a self-contained file, since Direct Export to Compressor is so very slow, even for simple timeline projects.
    Unfortunately with these bugs, you'll have to decide between saving space or time... unfortunately not both.
    If you are compressing a one-hour project, I'd recommend you do it CBR since it will be a lot faster in Compressor than VBR, which again has been exhibiting a MUCH slower encode time than in previous versions. CBR will give you more predictable output file sizes.
    I'm very disappointed that Apple has not addressed these issues when so many people have been so vocal about it.

Maybe you are looking for

  • Access to variables in an until clause of a wait activity

    Hi, I want to write a wait activity waiting for a variable to be set to a specific value. My code is something like <process name="VacationRequest" targetNamespace="http://xmlns.oracle.com/Test" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-p

  • No internet connection MBP Retina

    All to often I get the message No internet connection on my MacBook Pro Retina (13"). It's connected to the local network but won't reach the internet. (I do get an IP address etc, but the AirPort logo just shows an ! I can reach the internet on othe

  • Instrument i/o

    Hello guys, i'm working with LabView 7.1 and want to read out of measured values (pressure) by an AD-converter (source is a pressure gage). I read my RS232 with the tool Visa. My problem is, that display unit of measurement (mmHg/psi) and not my meas

  • Really try hard

    i have a question about couldn't compile servlet for few days. try many way to do, but still don't know where is the problem. i am using Java Web Server2.0, the servlet is worte following the ex. in the book (not from any demo doc). i already set up

  • RMBP A1398 - unable to boot and install OS X

    I changed keyboard from japanese to norwegian and the bottom cover. This went without complications. When I booted with new hardware  - just grey Apple screen and a spinning wheel that stopped. Trying to recover, internet recovery, single mode, secur