1

在我的<ui:composition..>代码块中,我尝试使用<h:outputText ..>标记呈现的所有内容都不遵守以下定义的类<h:outputStylesheet library="css" name="imagens/index.css">

这是我的代码:

<ui:composition ...>
    <ui:define name="conteudoRodape">
       <h:outputStylesheet  library="css" name="imagens/index.css">
           <h:outputText styleClass="centro" value="Acessando como: Filial:" />
       </h:outputStylesheet>
       ...
    </ui:define>
</ui:composition>

这是如何引起的,我该如何解决?


要回答您的具体问题,您可以使用按钮上的 enabled 属性。在您的 playSound() 方法中,执行以下操作::

public function playSound():void {
    sndChannel=snd.play();
    playButton.enabled = false;
}   

请务必向您的 playButton 添加一个 Id:

<s:Button id="playButton" label="play" click="playSound();"/>

您可能需要考虑在 playSound() 方法中添加一个检查,以便在声音已经播放时不播放它。为此,首先创建一个变量:

protected var isPlaying : Boolean = false;

然后像这样调整 playButton() 方法:

public function playSound():void {
   if(!isPlaying){
    sndChannel=snd.play();
    isPlaying = true;
   }
}   

在上述任何一种情况下,您可能都希望将事件侦听器添加到完整事件,以便重新启用按钮或更改 isPlaying 标志。该方法将是这样的:

public function playSound():void {
   if(!isPlaying){
    snd.addEventListener(Event.COMPLETE,onSoundComplete);
    sndChannel=snd.play();
    isPlaying = true;
   }
}   

public function onSoundComplete(event:Event):void{
  isPlaying = false;
  playButton.enabled = true;
  snd.removeEventListener(Event.COMPLETE,onSoundComplete);
}

您还可以从停止声音方法中调用 onSoundComplete 方法:

    public function stopSound():void {
        sndChannel.stop();
        onSoundComplete(new Event());
    }   
4

1 回答 1

0

I think your problem is that you're nesting an h:outputText tag inside h:outputStylesheet, as well as using the library name in the name attribute. Try changing:

<h:outputStylesheet  library="css" name="imagens/index.css">
<h:outputText styleClass="centro" value="Acessando como: Filial:" />
</h:outputStylesheet>

to:

<h:outputStylesheet library="css/imagens" name="index.css" />
于 2012-10-02T22:28:04.767 回答