|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi everyone!
I have a little problem: I made a flash site with its different sections, the first of which has a movie clip which is a "VideoPlaylist". So inside this movie clip I have the player and the videos sequenced one after the other in a TileList component. The problem is: When I go to a different page, the video in the first page continues to play and so you can still hear the sound, AND WHICH IS WORSE, when you click the button to return to the first page, the video starts again with the sound of the previous time still rolling. The solution would be, I suppose, when clicking to any of the buttons that link to another section of the flash document, add some action script to make the video stop (having in mind that the video player is inside a movie clip). I don't know action script, just the navigation basics necessary for the sections. I did the videoplaylist following this tutorial: http://www.adobe.com/devnet/flash/ar..._playlist.html Can anyone me, please!! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
assuming that you are using an FLVPlayback component for the videos - you can
simply target the instance and tell it to: my_mc.my_FLV.stop(); //for any other button OR my_mc.my_FLV.play(); //for the 'home' button return remember that both the MC and the FLV instances need to have 'instance names' assigned in the properties panel in order to target them with your code(s). |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thanx clbeech, but it didn't work at all... so I tried something else: I tried
to assign another function to the buttons that bring you to the different pages... but, it gave me the error of "duplicate function definition". But without the navigation function it works, that's the point. I show you here an example of the result actions code, with just one button as an example (the instance of the movie clip which contains the player and tilelist is called "myPlayer" and the instance of the FLVPlayback is called "myVid", the button instance is called "project" and the frame it takes you to is called "project" to). stop(); function onProjectClick(evt:MouseEvent):void { myPlayer.myVid.stop(); project.addEventListener(MouseEvent.CLICK, onProjectClick); function onProjectClick(evt:MouseEvent):void { gotoAndStop("projet"); project.addEventListener(MouseEvent.CLICK, onProjectClick); That's it. So the question: is there a solution to allow duplicate function to a button, or what can I do? I don't know why what you told me doesn't work. Another solution would be assigning the stop function to the video to a frame, so when we navigate to that frame, which would be a section that doesn't contain the player, the player would stop. But I don't know if that's possible... Thanks for your , Pau |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
ok i see you're using AS3 - well here's the thing you can't make duplicate
method 'names' (even in 2), but you can assign multiple listeners to the same method, and handle multiple calls within a method. additionally, you can use the event.target property converted to a string to navigate your timeline, provided that the name of the button(s) match the timline labels (as it appears you may be doing) - so you could restructure the method like so: stop(); function onClick(evt:MouseEvent):void { myPlayer.myVid.stop(); gotoAndStop(evt.target.name.toString()); } project.addEventListener(MouseEvent.CLICK, onClick); anotherButton.addEventListener(MouseEvent.CLICK, onClick); yetAnotherButton.addEventListener(MouseEvent.CLICK , onClick); |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
I would use evt.currentTarget.name, just for best practices. No need for toString as it already returns a string.
|
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Thanx for your clbeech and dzedward. I succeeded in the end.
The truth is I've had yet to solve something because of having the buttons in a layer appart with just one keyframe, common for all sections. It worked fine when I clicked from the main page where the player is (it stopped the video and navigated to the section it was supposed to), but when clicking a button from this other section i got this: TypeError: Error #1009: Cannot access a property or method of a null object reference. at VideoPlaylistSeq_fla::MainTimeline/onClick() So I suppose they wanted to stop the player which wasn't visible right then. So I created another frame in that navigation layer where I instanced the buttons differently for the rest of the sections, and wrote the action script to navigate without the stop video thing. But for my surprise it didn't work. So I tried the same but this time I put the buttons of the first page (the ones that are supposed to stop the video player too) in the same layer and keyframe where the video is. And I don't know why this makes the difference but it does. |
|
![]() |
| Outils de la discussion | |
|
|