Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Flash/Flex > Flash > AS1/AS2
AS1/AS2 Questions relatives à la programmation ActionScript 1 et 2 (Cours AS2)
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 18/12/2006, 11h46   #1
BnA
Membre éclairé
 
Avatar de BnA
 
Inscription : mars 2006
Messages : 559
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : mars 2006
Messages : 559
Points : 380
Points : 380
Envoyer un message via MSN à BnA
Par défaut [AS] Affichage du status du micro

Hello!!

Voilà, j'aimerais afficher sur mon animation le status actuel du micro.

Au lieu d'avoir muted/unmuted, j'aimerais avoir OFF/ON...

Voici mon code:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
this.createTextField("muted_txt", this.getNextHighestDepth(), 350, 40, 150, 22);
muted_txt.autoSize = false;
muted_txt.html = true;
muted_txt.selectable = false;
muted_txt.htmlText = "<a href=\"asfunction:System.showSettings\"><u>Click Here</u></a> to Allow/Deny access.";
 
 
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
active_mic.onStatus = function(infoObj:Object) {
     micOff_txt._visible = active_mic.muted;
     muted_txt.htmlText = "Status: <a href=\"asfunction:System.showSettings\"><u>"+infoObj.code+"</u></a>";
};
 
if(active_mic.muted){
this.createTextField("micOff_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
micOff_txt.html = true;
micOff_txt.autoSize = true;
micOff_txt.htmlText = "<font size='40' color='#FF0000'>Mic: OFF</font>";
micOff_txt._x = (Stage.width-micOff_txt._width)/2;
micOff_txt._y = (Stage.height-micOff_txt._height)/2;
micOff_txt._visible = active_mic.muted;
}
 
 
 
this.createTextField("micOn_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
micOn_txt.html = true;
micOn_txt.autoSize = true;
micOn_txt.htmlText = "<font size='40' color='#FF0000'>Mic: ON</font>";
micOn_txt._x = (Stage.width-micOn_txt._width)/2;
micOn_txt._y = (Stage.height-micOn_txt._height)/2;
if(active_mic.muted != true){
	micOn_txt._visible=true;
}
Bon, alors en gros, j'aimerais que lorsque mon micro est coupé (muted), ça affiche "Mic: OFF", et lorsqu'il est unmuted, "Mic: ON".

Pour le moment, si lors du chargement de mon animation mon micro est coupé, elle affiche les 2 status, et lors du changement de status (muted -> unmuted), seul le "Mic: ON" reste.

Si mon micro est actif lors du chargement de mon anim, le "Mic: ON" est affiché seul, mais il reste le seul affiché si je change le status du micro (unmuted-> muted)...

Bref, comme vous voyez, un joli petit casse-tête... Si une bonne âme pouvait me dire où est mon erreur, je lui ferais un gros bisou!! ('fin, si elle a du poil au menton peut-être pas...)

Merci d'avance!
BnA est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/12/2006, 13h16   #2
BnA
Membre éclairé
 
Avatar de BnA
 
Inscription : mars 2006
Messages : 559
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : mars 2006
Messages : 559
Points : 380
Points : 380
Envoyer un message via MSN à BnA
Bon, alors j'ai déjà simplifié grandement mon code, en virant tout ce qui ne m'intéresse pas...

Voici ce qui reste...

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
this.createTextField("muted_txt", this.getNextHighestDepth(), 350, 40, 150, 22);
muted_txt.autoSize = false;
muted_txt.html = true;
muted_txt.selectable = false;
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
active_mic.onStatus = function(infoObj:Object) {
   	 trace(active_mic.muted);
	 if(active_mic.muted==true){
     	         muted_txt.htmlText = "Mic: OFF";
	 }
	 else{
		 muted_txt.htmlText = "Mic: ON";
	}
};
Seulement voilà... Ce "muted_txt" ne s'affiche que lorsque j'ai été dans "Paramètres", pas avant...

Comment faire pour l'afficher dés le chargement de mon anim??
BnA est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/12/2006, 13h25   #3
BnA
Membre éclairé
 
Avatar de BnA
 
Inscription : mars 2006
Messages : 559
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : mars 2006
Messages : 559
Points : 380
Points : 380
Envoyer un message via MSN à BnA
Voici encore une amélioration...

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
 
this.createTextField("muted_txt", this.getNextHighestDepth(), 350, 40, 150, 22);
muted_txt.autoSize = false;
muted_txt.html = true;
muted_txt.selectable = false;
var active_mic:Microphone = Microphone.get();
 
if(active_mic.muted==true){
    muted_txt.htmlText = "Mic: OFF";
}
else{
    muted_txt.htmlText = "Mic: ON";
}
Mais si je change le status du micro, l'affichage n'est pas mis à jour...
BnA est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/12/2006, 16h37   #4
Membre Expert
 
Avatar de jean philippe
 
Inscription : septembre 2006
Messages : 2 062
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 2 062
Points : 2 075
Points : 2 075
Envoyer un message via MSN à jean philippe Envoyer un message via Skype™ à jean philippe
c'est un truc du genre que tu cherches ?
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
this.createTextField("muted_txt", this.getNextHighestDepth(), 10, 10, 100, 22);
muted_txt.autoSize = true;
muted_txt.html = true;
muted_txt.selectable = false;
muted_txt.htmlText = "<a href=\"asfunction:System.showSettings\"><u>Click Here</u></a> to Allow/Deny access.";
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
active_mic.onStatus = function(infoObj:Object) {
	status_txt._visible = active_mic.muted;
	muted_txt.htmlText = "Status: <a href=\"asfunction:System.showSettings\"><u>"+infoObj.code+"</u></a>";
	if (infoObj.code == "Microphone.Unmuted") {
		trace("Unmuted");
		fb.text = "ON";
	}
	if (infoObj.code == "Microphone.Muted") {
		trace("Muted");
		fb.text = "OFF";
	}
};
this.createTextField("status_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
status_txt.html = true;
status_txt.autoSize = true;
status_txt.htmlText = "<font size='72' color='#FF0000'>muted</font>";
status_txt._x = (Stage.width-status_txt._width)/2;
status_txt._y = (Stage.height-status_txt._height)/2;
status_txt._visible = active_mic.muted;
je te joins le fichier modifié
__________________
mon Blog
jean philippe est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/12/2006, 15h22   #5
BnA
Membre éclairé
 
Avatar de BnA
 
Inscription : mars 2006
Messages : 559
Détails du profil
Informations personnelles :
Âge : 28

Informations forums :
Inscription : mars 2006
Messages : 559
Points : 380
Points : 380
Envoyer un message via MSN à BnA
Plus ou moins...

(Toi t'as été récupéré le code de l'aide de Flash non?? )

Mais bon, voilà, le code que j'ai bidouillé me convient car je dois de toute façon faire un "refresh" de mon anim, donc ce problème-là ne se pose plus...


Merci à toi! ++
BnA est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h49.


 
 
 
 
Partenaires

Hébergement Web