Jump to content
Search Community

Quick SelfLoader question

BladePoint test
Moderator Tag

Recommended Posts

I need my SWF to display a loading progress screen, and the loader cannot be an external SWF file. Also, I have a lot of assets with the [Embed] tag, which caused problems with other internal preloader methods. Will LoaderMax's SelfLoader solve all those problems for me?

Link to comment
Share on other sites

Hi,

 

The issue with [embed] (I'm quite sure) is that all those assets are part of frame1 of the resulting swf. No code on frame 1 can execute until the entire frame is fully loaded. 

 

Chances are the other loaders you tried would take a while to show up, and when they did they would immediately jump to 95% or some other really high number. 

 

SelfLoader is no different, it won't be able to initialize until frame 1is loaded. Typically with a situation where you don't use external loading but want to track self loading, you would dump all your heavy assets on frame 2 of a timeline and put only your loading code and progress bar assets on frame 1 (keeping the initial load prior to the first elements rendering on screen as lean as possible). 

 

If you're using [embed] I imagine you are building a pure-AS3 or flex app where there isn't a timeline and off-loading assets to another frame isn't possible, or atleast I don't know how that would be done.

  • Like 1
Link to comment
Share on other sites

Yeah, that's exactly what was happening. My [embed]s are actually all FLV videos, so I guess if I replaced those all with LoaderMax's VideoLoaders, that would solve my problems, but I would prefer not to have the FLVs as external files. It seems most Flash portal sites only allow you to upload one SWF, so the external files would have to be hosted elsewhere. That's also why I can't use an external preloader.

 

Here's my whole situation. My Flash webgame is going to have a lot of voiced dialogue, and I wanted at least the beginning parts to be embedded in the SWF. Depending on the total filesize, I might load the rest later or just embed them as well. I found that the AAC audio codec has really good quality at low bitrates versus MP3, but Flash Professional CS6 doesn't natively support AAC so I have to do some workarounds. I have to create an FLV video that has no video track and just my AAC audio track. Then I embed the FLV and make a Video:

 

[Embed(source = "myAudio.flv",mimeType = "application/octet-stream")]
public var myAudio:Class;

public var fakeFLV:Video = new Video(0,0);

Then do the whole NetConnection and NetStream thing:

 

nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc); 

Make a ByteArray out of my embedded FLV and append it to the NetStream to play it:

var myAudioByteArray:ByteArray = new myAudio();
ns.play(null);
ns.appendBytes(myAudioByteArray);
fakeFLV.attachNetStream(ns); 

If someone has an idea of how to do what I want to do (1 single SWF with all assets and preloader), I'm open to suggestions. I think there's a way to do it in Flash Builder with the [Frame(factoryClass="")] tag, which does not work in Flash Pro CS6, so I would have to learn how to use Flash Builder instead.

 
Link to comment
Share on other sites

These are the only options as far as I am aware.

 

Exporting from Flash IDE:

    1 swf: loader code on frame 1, content on frame 2

    2 swf: keep your project as it is and use a preloader swf

 

Exporting from FlashDevelop, Flash Builder etc

    1 swf: keep your project as it is and use a factoryClass for your loader code

 

In my experience a separate programming/compiling environment is the way to go. I recommend trying FlashDevelop (it's free), although Flash Builder is good too. You can still develop and maintain your assets in Flash Pro and just export the assets as a .swc file. This tutorial should give you some idea of what can be done.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...