PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Graphisme & Infographie > macromedia.flash > Making a video stop using an external button from theplayer
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Making a video stop using an external button from theplayer

Réponse
 
LinkBack Outils de la discussion
Vieux 26/05/2008, 15h47   #1
Pau Perez
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Making a video stop using an external button from theplayer

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

  Réponse avec citation
Vieux 26/05/2008, 17h08   #2
clbeech
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Making a video stop using an external button fromthe player

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


  Réponse avec citation
Vieux 27/05/2008, 13h48   #3
Pau Perez
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Making a video stop using an external button fromthe player

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

  Réponse avec citation
Vieux 27/05/2008, 14h48   #4
clbeech
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Making a video stop using an external button fromthe player

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);

  Réponse avec citation
Vieux 27/05/2008, 15h06   #5
dzedward
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Making a video stop using an external button fromthe player

I would use evt.currentTarget.name, just for best practices. No need for toString as it already returns a string.
  Réponse avec citation
Vieux 28/05/2008, 14h57   #6
Pau Perez
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Making a video stop using an external button fromthe player

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.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h33.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13625 seconds with 14 queries