簡體   English   中英

Adobe Flex / Actionscript:可編輯標簽

[英]Adobe Flex/Actionscript: editable label

我正在做一個項目,如果我們有editbale標簽,或者如果TextInput的區域沒有用鼠標懸停,則它看起來會像Label一樣,這真的很好。

我在Flex剛起步,不知道如何開發皮膚。 我什至不知道是否可能僅通過剝皮就可以做到這一點。

無論如何,我幾個月前就發現了這個問題,但我無法正常工作,它只顯示一個空白頁面。

這是我在上面的鏈接中提到的用於創建可編輯標簽的代碼:

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

知道為什么顯示的頁面為空嗎? 還是其他方法?

預先感謝,馬庫斯

我遇到了與此可編輯標簽相同的問題。
我認為根本原因來自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和“視圖”中顯示組件之間存在差異。 Application ,某些異常會自動捕獲,從而使調試過程變得更加困難。
希望這會有所幫助!

在一個我們正在研究的項目中,我們使用文本框做了可編輯的標簽,並刪除了背景和邊框(它看起來就像一個標簽,並且是可編輯的)。 在您的情況下,您可以執行此操作,然后在mouseIn上再次顯示邊框和背景(使其看起來像文本框),然后在MouseOut上再次刪除til樣式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM