Comunidad de diseño web y desarrollo en internet online

Problema con SupetabNavigator

Citar            
MensajeEscrito el 03 May 2009 10:38 am
Hola muy buenas.... tengo un problema en un programa creado en Flex 3 en el cual me kedao atascado. mi problema es que no consigo que al cerrar un Tab del SuperTabNavigator me devuelva el label de dicho Tab. Soy novato en todo esto y no se si exite alguna clase o algo para poder conseguir que me devuelva dicho label al cerrar dicho tab. Un saludo y gracias.

Por Technics

5 de clabLevel



 

msie7
Citar            
MensajeEscrito el 04 May 2009 12:20 pm
Para acceder al tab seleccionado usa TabNavigator.selectedIndex , luego el label del tabNavigator corresponde al label del elemento que esté en esa posición, es decir algo como TabNavigator.getChildAt(TabNavigator.selectedIndex).label ... si te da error, debes hacer un cast al elemento que sea, por ejemplo Panel(TabNavigator.getChildAt(TabNavigator.selectedIndex).label)

Donde dice TabNavigator debes reemplazarlo por el id de tu TabNavigator

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 05 May 2009 05:21 pm
Hola jorge gracias por responder te comento probe lo que me indicaste y me sale el siguiente error

1119: Acceso a una propiedad label posiblemente no definida mediante una referencia con tipo estático flash.display:DisplayObject.

te comento que el label de este tab lo coje de un contenedor

Código :

private function tabCloseHandler(event:SuperTabEvent):void {
AQUI TU CODIGO ---> this.flexIrcClient.partChannel(channelViewStack.getChildAt(channelViewStack.selectedIndex).label);
}
internal function buildNewPrivateUI(privado:String, icon:Class=null):UIComponent
{
var privateWindow:PrivateWindow = new PrivateWindow();
privateWindow.id = privado;
privateWindow.label = privado;
privateWindow.icon = icon;
privateWindow.privado = privado;
privateWindow.flexIrcClient = this.flexIrcClient;
privateWindow.registerListeners(this.flexIrcClient);
return privateWindow;

}


protected function addPrivado(event:UserEvent):void 
{

var privado:String = event.privado;
if (ListPrivados(privado) != 0) {
channelViewStack.addChild(this.buildNewPrivateUI(privado, privat)); } 

} 
<ns3:SuperTabNavigator width="80%" height="80%" id="channelViewStack" horizontalCenter="0" y="66" styleName="logwindow" backgroundColor="#333333" tabClose="tabCloseHandler(event);">
<mx:VBox label="Estado" height="100%" width="100%" styleName="logContainer">
<mx:TextArea height="100%" width="100%" id="serverLog" editable="false" styleName="logWindow" backgroundColor="#999999"/>
<mx:HBox width="100%" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5">
<mx:TextInput width="100%" id="cmdLine" enabled="{connected}" enter="sendCommand()"/>
<mx:Button label="Enviar" id="sendButton" enabled="{connected}" click="sendCommand()"/>
</mx:HBox>
</mx:VBox>
</ns3:SuperTabNavigator>

Por Technics

5 de clabLevel



 

msie7
Citar            
MensajeEscrito el 05 May 2009 05:31 pm
Ok, pense que lo de Super era un nombre de instancia, SuperTabNavigator no es un TabNavigator, aunque supongo que extiende de TabNavigator (verifica)
El cast que hice es justamente para evitar ese error, en tu caso es un VBox:

VBox(SuperTabNavigator.getChildAt(TabNavigator.selectedIndex)).label

Luego agrégale un label al VBox

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 05 May 2009 05:41 pm
perdona mi ignorancia pero soy novaato en esto... ese cast que me iciste dnd lo coloco? Gracias de nuevo

Por Technics

5 de clabLevel



 

msie7
Citar            
MensajeEscrito el 05 May 2009 05:49 pm
Ah, donde pone aquí tu código lo pusiste, entonces sería

VBox(channelViewStack.getChildAt(channelViewStack.selectedIndex)).label;

Pues hasta donde veo es lo único que tiene tu SuperTabNavigator

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 05 May 2009 06:08 pm
nada sigue sin funcionar... tengo que decirte que los tab los creo apartir de otros .mxml por ejemplo:

para crear el tab Hola:

internal function buildNewChannelUI(channel:String, icon:Class=null):UIComponent
{
var channelWindow:ChannelWindow = new ChannelWindow(); ---> archivo ChannelWindow.mxml
channelViewStack.label = channel;
channelWindow.label = channel;
channelWindow.icon = icon;
channelWindow.channel = channel;
channelWindow.flexIrcClient = this.flexIrcClient;
channelWindow.registerListeners(this.flexIrcClient);
return channelWindow;

}

protected function addPrivado(event:UserEvent):void
{

var privado:String = event.privado;
if (ListPrivados(privado) != 0) {
funcion que yama al archivo ChannelWindow.mxml ---> channelViewStack.addChild(this.buildNewPrivateUI(privado, privat));
}

}
no se si me explico bien...

Por Technics

5 de clabLevel



 

msie7
Citar            
MensajeEscrito el 05 May 2009 06:13 pm
Ninguno de los tags que usas es un tag standard, por lo cual entiendo pillaste un aplicación muy elaborada y customizada, con lo cual deberás adaptar conceptualmente lo que digo a tu entorno.

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.