olá pessoal,
to com um probleminha aqui, num sei se sou eu, ou se é coisa do
flex... rs
tenho no item renderer do meu tile list um Label... fiz um eskema pra
tratar a string do label pra quebrar linhas, colocar \n a cada 34
caracteres, que e o que cabe de largura no tile, até aí tudo bem,
depois fiz um eskema pra ele verificar quantas linhas teriam e
retornar o tamanho de altura do label, ele retorna, porém, ele não o
utiliza, pelo que verifiquei ele tah utilizando o do primeiro label,
se o primeiro retornou 20 ele vai colocar altura 20 em todos... isso é
problema do meu código ou do Flex?
Segue os códigos utilizados
Scripts:
public function trataString(str:String):String{
var nstr:String = "";
var vstr:String = str;
var n:int;
var num:int = 1;
if (str.length > 34){
n = (str.length/34);
//Alert.show("subtracao: "+String(str.length - (n * 25)));
if ((str.length - (n * 34)) > 0){
num = (str.length/34) + 1;
} else {
num = (str.length/34);
}
//Alert.show("num: "+String(num));
}
for (var x:int=1;x<=num;x++){
var com:uint;
if (x==1){
com = 0;
} else {
com = ((x-1)*34)-1;
}
var fim:uint;
if (x==num){
fim = vstr.length-1;
} else {
fim = com + 33;//(x*25)-1;
}
/* Alert.show(
"x: "+String(x)+
"\ncomeço: "+String(com)+
"\nfim: "+String(fim)+
"\nstring: "+String(str.substr(com,fim).substr(0,24))+
"\ntotal de caracteres:
"+String(str.substr(com,fim).substr(0,24).length)
); */
nstr = nstr+str.substr(com,fim).substr(0,33)+"\n";
}
if (num==1){
return str;
}
return nstr;
}
public function tamanhoLabel(l:int):int {
var num:int;
var n:int;
if (l > 34){
n = (l/34);
//Alert.show("subtracao: "+String(str.length - (n * 25)));
if ((l - (n * 34)) > 0){
num = (l/34) + 1;
} else {
num = (l/34);
}
//Alert.show("num: "+String(num));
} else {
num = 1;
}
Alert.show("Tamanho label: "+String(l)+"\ntamanho final:
"+String(num*20)+"\nnum: "+String(num));
return num*20;
}
trataString é pra colocar quebra de linha, tamanhoLabel é pra dar o
height
e o meu itemrenderer tah assim:
<mx:Label buttonMode="true" useHandCursor="true" width="200"
toolTip="{data.nome}" fontSize="10" color="#3e3e3e">
<mx:height>{outerDocument.tamanhoLabel((data.nome as String).length)}
</mx:height>
<mx:htmlText><p align='left'>
{outerDocument.trataString(data.nome)}</p></mx:htmlText>
</mx:Label>
detalhe, se eo coloco manualmente tipo 40, ou 60 ele vai só que em
todos, se eo tento colocar de forma dinâmica não funciona.... nem
mesmo com o trio (lenght>30)?60:40 não tah funcionando...
Valew desde já!
--
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para
[email protected]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev