Share Posted February 24, 2012 var sim:Sprite = new Sprite; var video:VideoLoader = new VideoLoader("assets/SEI_EDU_Math_Demo.f4v", {name:"simVid", container:sim, bgColor:0xffffff, autoPlay:false, estimatedBytes:92000}); why does this not work? sim.playVideo(); or at least this: sim.video.playVideo(); is loadermax putting the video in a container in my sim Sprite that i can only acsses with getContent(); say it isn't so Link to comment Share on other sites More sharing options...
Author Share Posted February 24, 2012 Ok so if i want to load a video and treat it like a display object i have to do this. var elArray:Array = new Array(bigIdeas,video.content); video.content.x = 180; video.content.y = 220; video.content.name = "sim"; addChild(video.content); how do i get a reference to the loader from the content object loaderMax.getLoader(elArray[1]).playVideo(); What?? Link to comment Share on other sites More sharing options...
Share Posted February 24, 2012 var sim:Sprite = new Sprite; var video:VideoLoader = new VideoLoader("assets/SEI_EDU_Math_Demo.f4v", {name:"simVid", container:sim, bgColor:0xffffff, autoPlay:false, estimatedBytes:92000}); sim.playVideo(); why does this not work? Sprites do not have a playVideo() method, but VideoLoaders do. you want to use any of the following: video.playVideo() // shortest and most intuitive LoaderMax.getLoader("simVid").playVideo(); LoaderMax.getLoader("assets/SEI_EDU_Math_Demo.f4v").playVideo() ----- is loadermax putting the video in a container in my sim Sprite that i can only acsses with getContent(); VideoLoader automatically creates a ContentDisplay object (a Sprite) that contains a Video object to which the NetStream is attached (learn more: http://www.greensock.com/as/docs/tween/ ... splay.html ). In your case the ContentDisplay object gets placed inside the sim container as specified in the VideoLoaders special props. Just to be absolutely clear VideoLoader has methods for loading and controlling playback of the video. The content/ContentDisplay is really only used for controlling how and where the video is displayed ie: position, scaleMode, cropping. You rarely have to access or target the ContentDisplay object. But when you do, the ContentDisplay object is given the same name property as defined in your VideoLoader. So in your case video is the name of the VideoLoader video has a Content Display object named "simVid" "simVid" is being placed inside the container sim. you can access the content of any loader a number of ways: //through the container sim.getChildByName("simVid").rotation = 45 //or via the content of the VideoLoader video.content.rotation = 45 //or search LoaderMax for the content via name or url LoaderMax.getContent("simVid").rotation = 45; //or although a bit ridiculous it is possible to find the loader and then target its content LoaderMax.getLoader("simVid").content.rotation = 45; I think once you wrap your head around the roles and responsibilities of the loader and the content you will find that it is an incredibly flexible, powerful and easy to use system. Link to comment Share on other sites More sharing options...
Author Share Posted February 24, 2012 Carl, Thank you for your very detailed explanation. I now understand that I need to access both the video's loader and its content display object in order to add it to the display list, position it and then play it. I wish there was a way to access the video’s loader through its display container. So i could pass a reference to the video's display container between classes and control it's playback the through the same reference. even if it was like this: sim.getLoader("simVid").playVideo(); or even this: sim.getChildByName("simVid").getLoader("simVid").playVideo(); but it looks like I wont be able to do that. Thanks again your responses are always very helpful!! Link to comment Share on other sites More sharing options...
Share Posted February 24, 2012 glad the explanation helped, but I left out one thing! the content DOES have a loader property that refers to the loader that it belongs to. from the ContentDisplay docs A container for visual content that is loaded by any of the following: ImageLoaders, SWFLoaders, or VideoLoaders. It is essentially a Sprite that has a loader property for easily referencing the original loader, as well as several other useful properties for controling the placement of rawContent and the way it is scaled to fit (if at all). you can do: sim.getChildByName("simVid").loader.playVideo( ); if the Content Display object is the only thing in sim, you could also find it by its index in the display list sim.getChildAt(0).loader.playVideo(); hope this helps Link to comment Share on other sites More sharing options...
Author Share Posted February 24, 2012 It does help. Thanks! Link to comment Share on other sites More sharing options...
Share Posted March 16, 2012 This makes no sense sorry. I have used appended a video to a queue and am not able to access it as DisplayContainer does not contain video controls. queue.append(new VideoLoader("media/" + val, {name:val, container:holder, alpha:0, autoPlay:false, scaleMode:"proportionalInside"})); Attempting to access this via the name property returns the videoloader, however it can not be played. LoaderMax.getContent(value).playVideo(); It returns Property playVideo not found on com.greensock.loading.display.ContentDisplay This can not be cast to VideoLoader object either. Link to comment Share on other sites More sharing options...
Share Posted March 16, 2012 According to your own example you have to ask the loaderMax to return the loader and then reference the loader again - really poor. You tags arent working ?? LoaderMax.getContent(media[counter].value).loader.playVideo(); The VideoLoader does not extend the DisplayContainer class so you are unable to reference every object inside the LoaderMax class via a looped array - it throws an error as they are not all of the same type. Link to comment Share on other sites More sharing options...
Share Posted March 16, 2012 The same issue is now occurring with SWFLoader, we are not able to access the standard swf class. We should simply be able to cast any loader to its intended object, so Video is Video, SWF is SWF, Image is Image etc, So all the normal Video methods, SWF methods are available to that loader object. Link to comment Share on other sites More sharing options...
Share Posted March 16, 2012 Audus, it is difficult to follow your multiple posts or know who you are addressing. After reading this entire thread, you really shouldn't be trying: LoaderMax.getContent(value).playVideo(); you should use getLoader() to control the video, not getContent(). Above there is a thorough description of the roles of the Loader and the ContentDisplay object. You can read more in the docs. According to your own example you have to ask the loaderMax to return the loader and then reference the loader again - really poor. 1 LoaderMax.getContent(media[counter].value).loader.playVideo(); I don't think I'm following you here. There is no reason to double reference anything. I have reviewed this post and can't seem to establish how you claim that the code you included was recommended. there is no reason to to LoaderMax.getContent("someLoader").loader.playVideo(); you would just do LoaderMax.getLoader("someLoader").playVideo(); Please keep in mind that this post originated because the original poster was trying to solve a very unique problem of trying to access a loader and its content via the name of a container Sprite that he had created. The same issue is now occurring with SWFLoader, we are not able to access the standard swf class. to call methods on a loaded swf, use can use the SWFLoader's rawContent http://www.greensock.../SWFLoader.html I think you will find that using LoaderMax in the way it was intended is actually quite sensible and alleviates many of the hassles of loading and controlling many items. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now