Jump to content


VideoLoader vs. ContentDisplay - how to play(), stop() etc...

Recommended Posts

Hello there,


I have an issue with gathering VideoLoader from ContentDisplay (if this way is correct)


Simply, I load some video via VideoLoader appended to LoaderMax and after onComplete event I get ContentDisplay target. In the other class I retrieve the ContentDisplay and even works and play on stage beautifully, but the thing is I don't know how to control this.. I mean VideoPlayer contains methods, like playVideo etc... How can I get it in other class via ContentDisplay, because I got Video via rawContent, but actually I don't know if shall I use it.. and how to use it...


Is there a way to get it?


Thanks in advance!

Link to comment
Share on other sites

You can control the video playback methods like playVideo() and pauseVideo() directly through the VideoLoader that handled loading the video.




If you have access to the ContentDisplay of a VideoLoader, the ContentDisplay object has a loader property that refers to the VideoLoader that loaded it.




I'll admit I'm a little confused by the last part of your question.


The second best thing to reading the docs on VideoLoader and ContentDisplay is to read the activetuts tutorial on VideoLoader. It covers nearly everything.




Be sure to download the source files.

Link to comment
Share on other sites



are you sure? Because loader returns LoaderItem which does not contain playVideo(). It contains pause(), resume() but this simply does not work with the video that I have loaded.


But I checked the sources that you gave me and instead of LoaderMax.getContent("myVideo") //returns ContentDisplay


i Have used LoaderMax.getLoader("myVideo") and that's return VideoLoader :)


Thanks for the help! The best library ever!

Link to comment
Share on other sites

That's correct - the "loader" of a ContentDisplay is technically data typed to a generic LoaderItem for polymorphic reasons - SWFLoaders, ImageLoaders, and VideoLoaders all use a common ContentDisplay class. So the loader could be any of those types, but since you know that in your case it's a VideoLoader, you can simply cast it to that data type to avoid compiler errors:






var vl:VideoLoader = someContentDisplayObject.loader as VideoLoader;

  • Like 1
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.