Jump to content
Search Community

VideoLoader Captions and Addtional data

Carl test
Moderator Tag

Recommended Posts

i'm using loaderMax to load a series of videos. I can load them and play pause skip next prev... all that great

 

the xml is like this (slightly simplified)











 

 

I would like to associate some additional data with each video, to keep it simple let's just say a caption for each video:

 

I tried doing this

 

 

 

 

I'm using the activeTut's tutorial as a base, so I have an array called _videos which holds each VideoLoader.

 

 

Does LoaderMax do something with these xml attributes that aren't VideoLoader properties when it is creating each loader?

 

Is there a way to get the caption attribute / property of each loader without manually looping through or going back to the original xml?

I read this post about the props()

 

viewtopic.php?f=6&t=3947&p=15542&hilit=loaderMax+custom+variables#p15542

 

just wondering if there is something simpler that I'm not seeing

 

thx

Link to comment
Share on other sites

Does LoaderMax do something with these xml attributes that aren't VideoLoader properties when it is creating each loader?

 

Is there a way to get the caption attribute / property of each loader without manually looping through or going back to the original xml?

Absolutely. XMLLoader will put all of those attribute values (regardless of whether or not they are recognized LoaderMax properties) into the vars object. So, for example, if one of your XML nodes looked like this:


 

Then once it is parsed by XMLLoader, you'd be able to get the VideoLoader and its caption value like this:

 

var aboutVideo:VideoLoader = LoaderMax.getLoader("about");
trace("caption is: " + aboutVideo.vars.caption);

 

No need to dig into the XML manually to get that data (you're welcome to do that if you prefer of course).

 

Thanks for posting the question here so others can benefit from the answer too.

Link to comment
Share on other sites

Now to make things more interesting. Let's say each VideoLoader has a variable amount of structured data associated it with it, like a series of links someone can click for "related info".

 

I made my xml like this

 

 

 

 

 

each VideoLoader node now has a child node. This doesn't break anything with LoaderMax and I have successfully been able to parse how many "endLinks" each loader has and all the attributes by traversing the XML tree and it works just dandy.

 

Just curious if LoaderMax again does anything like detect if each Loader has any child nodes and stores that stuff in something like vars.xmlChildren.

 

this is not a feature request or urgent matter. just thinking out loud.

 

thanks

 

Carl

Link to comment
Share on other sites

Just curious if LoaderMax again does anything like detect if each Loader has any child nodes and stores that stuff in something like vars.xmlChildren.

Good idea! I tweaked it a little bit to provide even more flexibility in the latest version - now XMLLoader will add a "rawXML" property to the vars object which will contain the entire XML node (including children) associated with that parsed loader. That way, you can grab whatever you need directly from the XML data. Like this:

 

var aboutVideo:VideoLoader = LoaderMax.getLoader("about");
trace("XML node for the about VideoLoader: : " + aboutVideo.vars.rawXML);

 

Snag the latest version at

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