Jump to content
Search Community

Sound and mulitple VideoLoaders

dopper test
Moderator Tag

Recommended Posts

Thank you in advance. Great VideoLoader, love its features.

I am having a sound issue though.

I have three MCs in my FLA linked to the Main document.

I load each video player into a dummy container on a mouse click event and am able to remove the content from the container. However, the sound keeps playing.

I tried creating a dummy function with the Main class to pauseVideo but it comes back as undefined. i can trace (myMC.showVideo and return the fact that it is a function function {} so i know i can get into the class.)

So, simply how would i stop the sound using multiple loaders within the same project? Thank you.

Link to comment
Share on other sites

no. that didnt work i get undefined property error returned.....

 

stop();

 

var container:MovieClip = new MovieClip();

var currentPage:String = new String();

var twoDVid:video2DMC;

var threeDVid:video3DMC;

var testVid:testVidMC;

 

twoDMovies_btn.buttonMode = true;

threeDMovies_btn.buttonMode = true;

testAnimations_btn.buttonMode = true;

 

twoDMovies_btn.addEventListener(MouseEvent.CLICK, goMovies);

threeDMovies_btn.addEventListener(MouseEvent.CLICK, goMovies);

testAnimations_btn.addEventListener(MouseEvent.CLICK, goMovies);

 

function removeMovies(e:MouseEvent)

{

switch(e.currentTarget)

{

case twoDMovies_btn:

trace(container.name);

removeModules();

var twoDVid = new video2DMC();

twoDVid.name = "TwoD";

currentPage = twoDVid.name;

addChild(container);

container.addChild (twoDVid);

twoDVid.x = 134.65;

twoDVid.y = 59.6;

//trace(twoDVid.showVideo);

trace ("ok" );

break;

case threeDMovies_btn:

removeModules();

var threeDVid= new video3DMC();

threeDVid.name = "ThreeD";

currentPage = threeDVid.name;

addChild(container);

container.addChild (threeDVid);

threeDVid.x = 134.65;

threeDVid.y = 59.6;

trace("before pause")

twoDVid.pauseVideo();

trace("after pause")

break;

case testAnimations_btn:

removeModules();

var testVid = new testVidMC();

testVid.name = "Test";

currentPage = testVid.name;

addChild(container);

container.addChild (testVid);

testVid.x = 134.65;

testVid.y = 59.6;

//testVid.stopCurrentVideo();

break;

}

// if (container.twoDVid)

// {

// twoDVid.stopCurrentVideo();

// trace("ok")

// }

// else if (threeDVid)

// {

// threeDVid.stopCurrentVideo();

// }

// else (testVid)

// {

// testVid.stopCurrentVideo();

// }

}

function removeModules ()

{

while (container.numChildren)

{

container.removeChildAt (0);

trace(container.numChildren + "this sucks")

//trace(container.numChildren);

}

 

}

 

this is my code. i am aware that i'll need to do checks if someone is bouncing back and forth between sections, right now i'm just trying to get the sound to stop once. :) thank you

Link to comment
Share on other sites

Thanks for the code. I can only suspect that you aren't targeting the VideoLoaders properly. From the code provided I have no idea what stopCurrentVideo() or pauseVideo() do. Are those methods in your custom classes video2DMC video3DMC, and testVidMC?

 

pauseVideo() is a method of the VideoLoader, and it appears that you are using it on twoDvid and other instances of your custom classes. Can you provide the code that you use to create your VideoLoaders and explain where that is happening? if I can see how the VideoLoaders are referenced I can much better assist in figuring out why they aren't working.

 

Do you have a way of confirming that the videos stop playing but there sound doesn't when pauseVideo() is called? For instance have you tried not removing the VideoLoaders from the display list and calling pauseVideo() on them?

 

In the short term I would suggest getting away from controlling 3 videos. Make a file where 1 video loads and create a button that pauses the video (which will also pause the sound). Once you know how pauseVideo() works, you will have a better understanding of how to make it work in this more robust multi-video controller.

 

From what I can tell, the logic you set up looks pretty good. I think once you target the loaders it will all fall into place.

Link to comment
Share on other sites

Thanks Carl. So, I currently have one player that works with a play/pause button (www.davidjopperman.com in the theatre section. And within that I can confirm that the video and the sound both get paused.

 

stopCurrentVideo was a public function I set up within the custom class to make sure I could access that class. (it had a simple trace statement in it)

 

pauseVideo was based off of your suggestion. (unless i defined pauseVideo as a function because I added parathesis at the end ??? )

 

my custom class for video2DMC video3DMC, and testVidMC are the essentially they same they will just target different xml files. (I'm trying to break the player into sections basically one for 2D, 3D and testAnimations).

Link to comment
Share on other sites

Cool. Thanks for the clarification, That all makes sense.

 

Let me know if you need further assistance targeting and pausing each class's VideoLoader. It sounds like you have a solid system in place.

 

-c

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