Jump to content
Search Community

Modular Content Player: What's the best approach?

artbones test
Moderator Tag

Recommended Posts

I am building a presentation shell that loads JPGs, FLVs, and SWFs via XML. I want opinions on which LoaderMax methods will work best for my scenario before I get too involved.

  • 7+ JPGs for content that the client hasn't quite decided on yet and needs to review
  • 60+ FLVs for finished content. Each FLV will have an intro animation, a hold frame, and an outro animation.
  • 10+ SWFs for finished content. SWF will enable custom menus within the tool and allow for looping video within an intro and outro segment.

I've written the entire thing using NetStreams already, but I have some issues with content "flashing" on load and not fully unloading.

 

I want to give LoaderMax a try.

 

Earlier, I set the project up to use LoaderMax's queue, but with 60+ FLVs loading in all at the same time, it runs extremely sluggish. Otherwise, I was able to get it going like I wanted fairly easy. Does "queue" always load in everything at once?

 

Also, I set up a file to just use Loader objects individually without queue. It works well for the most part, but every FLV hiccups about 1 second into playing. I didn't have that issue when using NetStreams.

 

Is there a preferred method for creating a project where there are several different content types including some hefty FLV files? FYI, it will always run locally and never online.

Link to comment
Share on other sites

Hello artbones and welcome to the forums.

 

First, congratulations on converting your full featured project to using LoaderMax.

 

With anything "flash-related" its sort of tough to definitively state that any method for doing something is "the best" or "standard" way.

 

I would suggest loading all the "menu" swfs that are necessary for your app to function upfront and wait until the user requests the other assets like the 7 images and 60 videos before you load them.

 

You can create a LoaderMax queue of just the videos and instead of loading all the videos at once, you can step through the queue using LoaderMax's getChildAt() method. This would make programming "next" and "previous" buttons quite easy. So you could do something like:

 

var myVideos:LoaderMax = new LoaderMax("videos", {autoLoad:false});
myVideos.append(new VideoLoader( "video1.flv", {name:"video1"}) );
myVideos.append(new VideoLoader( "video2.flv", {name:"video2"}) );
myVideos.append(new VideoLoader( "video3.flv", {name:"video3"}) );

//to load the first video 

myVideos.getChildAt(0).load();

//or access the video by name:

myVideos.getLoader("video1").load();

So instead of using LoaderMax to load all your assets at once, you can use it simply to organize your loaders into a group and access them at will.

 

As for the hiccup issue, there is nothing in VideoLoader that should cause that to happen. I'm wondering if its just because Flash can't handle having a ton of large flvs in memory at once.

 

If you can create a simplified file that can reproduce the hiccup issue, we will take a look at it and see if we can assess what the problem might be.

Link to comment
Share on other sites

Thank you for your reply and the welcome. Your solution looks much more managable that how I was writing my code. The hiccup issue was due to a virus scan running in the background (doh!). That's what I get for working too late at night.

 

I do have another question concerning this loader if you can help. I want to avoid any flashing when I load in new content (I don't know that it is an issue with LoaderMax).

 

The way that I have been getting around that is to load each content one at a time with:

AddChildAt(name, 0);

 

..and once the complete handler was called, I was removing the child at 1. It seems that removeChild may leave residual flv garbage and be counter-intuitive to LoaderMax. Do you have any insight on how I could accomplish the same thing with LoaderMax?

Link to comment
Share on other sites

**EDITED, but left the post in case it helps someone else.

 

Also, I am getting a #1010 Error when trying to implement your code:

 


var count:uint = 0;
var presentationQueue:LoaderMax = new LoaderMax({name:"mainQueue", autoLoad:false});
for (var g:int=0; g<PresentationArray.length; g++){
for (var h:int=0; h<PresentationArray[g].length; h++){
 var content2BLoaded:String = "slides/"+PresentationArray[g][h].image;
 trace(content2BLoaded); // returns slides/slide1.jpg
 switch(PresentationArray[g][h].type){ // loading by type because each type has specific actions to play an outro or fade, etc. Probably a better way.
  case "jpg":
presentationQueue.append(new ImageLoader(content2BLoaded, {name:"slide"+count}) );
break;
  case "flv":
presentationQueue.append(new VideoLoader(content2BLoaded, {name:"slide"+count}) );
break;
  case "swf":
presentationQueue.append(new SWFLoader(content2BLoaded, {name:"slide"+count}) );
break;
  default:
// IMPROPER FILE TYPE
break;
 }
 count++;
 }
}
//to load the first video
 presentationQueue.getChildAt(0).load(); //#1010 ERROR: A Term is Undefined

 //or access the video by name:
 //presentationQueue.getLoader("slides0").load();

 

IGNORE the issue with #1010 ERROR. I found the issue. Flash didn't like:

switch(PresentationArray[g][h].type){

I switched it to the following and everything works properly now

var contentType:String = PresentationArray[g][h].type;
switch(contentType){

Edited by artbones
Link to comment
Share on other sites

Hi artbones,

 

Glad to hear that you made progress and figured out the 1010 error.

 

Are you still getting the flashing issue when you add/remove content? is it only with flvs? is the new content flashing or just the old content that is being removed?

 

I seem to recall that some have reported that Flash player has trouble removing flvs immediately, not 100% sure on that.

 

You could also see if setting the object's visible prop to false prior to removing might help.

Link to comment
Share on other sites

The flashing occurs when new content replaces old content. There is a split second where nothing occupies the stage. I am using a complicated workaround by doing something like:

 


// Add new content to the stage on the bottom of the stack
fullSlides.addChildAt(presentationQueue.getChildAt(evt.target.parent.SlideID).content,0);

// And when I am sure that it is loaded and any outro animations are played on the old content I call something like
fullSlides.removeChildAt(1);

The code is of course much more complex than that, but you get the idea. I'm wondering if there is a better way, keeping in mind that each 'old' content has an outro animation that plays before it is removed. (FYI, I am using cue points to trigger the removal)

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