2012-02-21 85 views
0

我正在开发一个项目,如果我们有编辑标签或者TextInput的一个区域,看起来像是一个标签,如果它没有用鼠标徘徊,那将会非常好。Adob​​e Flex/Actionscript:可编辑标签

我很新的Flex,并不知道如何开发皮肤。我甚至不知道是否可以通过剥皮来做到这一点。

无论如何,我发现this问题从几个月前,但我无法得到它的工作,它只是显示一个空白页。

在这里,我用来创建在上面的链接提到一个可编辑的标签代码:

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:component="com.npacemo.component.*" 
      xmlns:skins="skins.*"> 
<fx:Declarations> 
    <!-- Platzieren Sie nichtvisuelle Elemente (z. B. Dienste, Wertobjekte) hier --> 
</fx:Declarations> 
<s:BorderContainer>  
    <component:EditableLabel text="Text 132" skinClass="skins.EditableLabel" /> 
</s:BorderContainer> 

</s:Application> 

任何想法,为什么显示的页面是空的?还是采用不同的方法?

由于提前, 马库斯

回答

0

在我们用一个文本框,并去除背景和边框工作我们做编辑的标签项目(它看起来就像一个标签,将编辑)。在你的情况下,你可以做到这一点,然后在mouseIn中,你可以再次显示边框和背景(使其看起来像一个文本框),然后再次移除直方式时使用MouseOut。

0

我遇到了与此可编辑标签相同的问题。
我认为根本原因是从SkinPart:labelComponent。在皮肤内部,标签是这样的:

<s:Label id="labelComponent" text="{hostComponent.text}" 
     alpha.normal="1" alpha.selected="0" 
     visible.normal="true" visible.selected="false" 
     verticalCenter="0" width="{this.width+20}" maxDisplayedLines="1" 
     textDecoration="underline" buttonMode="true"/> 

由于宽度设置导致自引用循环,因此标签会抛出异常。这里的解决方案只是清除宽度设置:

<s:Label id="labelComponent" text="{hostComponent.text}" 
     alpha.normal="1" alpha.selected="0" 
     visible.normal="true" visible.selected="false" 
     verticalCenter="0" maxDisplayedLines="1" 
     textDecoration="underline" buttonMode="true"/> 

现在可以显示组件。
我发现在Application和View中显示组件有区别。在Application中,会自动捕获一些异常,从而使调试过程变得更加困难。
希望这会有所帮助!