Comunidad de diseño web y desarrollo en internet online

Problema con Focus y controles

Citar            
MensajeEscrito el 14 Feb 2007 03:36 pm
Amigos tengo un problema quisiera un poco de ayuda si es posible...
tengo una seccion de una pagina donde yo puedo agregar texto a unos cuadros tipo...customizar articulos...agregar texto, imagenes etc.
Pero mi problema radica qe cuando seleccion una opcion, hasta que doy el segundo click sobre una opcion.esta se me refleja...me podria alguien ayudar.

Código :

import mx.controls.*;
Selection.setFocus("1");
// strict type our component instances on the Stage.
var font_cb:ComboBox;
var size_cb:ComboBox;
var bold_button:Button;
var italic_button:Button;

var color_cb:ComboBox;
var viewStyle_button:Button;

Selection.setFocus("1");
font_cb.dataProvider = TextField.getFontList().sort();
// add a few standard font sizes to the size_cb ComboBox instance.
Selection.setFocus("1");
size_cb.dataProvider = [10, 11, 12, 13, 14, 15, 16];
// add a handful of common colors manually.
Selection.setFocus("1");
color_cb.addItem({data:0x000000, label:'Black'});
color_cb.addItem({data:0xFF0000, label:'Red'});
color_cb.addItem({data:0x00FF00, label:'Green'});
color_cb.addItem({data:0x0000FF, label:'Blue'});
color_cb.addItem({data:0xFFFFFF, label:'White'});

Selection.setFocus("1");
var mouseListener:Object = new Object();
mouseListener.onMouseUp = function() {
   if (getProperty(Selection.getFocus(), _name) =="1" ) {
      _global.beginIndex = Selection.getBeginIndex();
      _global.endIndex = Selection.getEndIndex();
   }
};
Mouse.addListener(mouseListener);
Selection.setFocus("1");
var styleListener:Object = new Object();
styleListener.change = function(eventObj:Object) {
   Selection.setFocus(null);
   applyStyle(eventObj);
};
styleListener.click = function(eventObj:Object) {
   applyStyle(eventObj);
   Selection.setFocus("1");
   Selection.setSelection(_global.beginIndex, _global.endIndex);
};
Selection.setFocus("1");
font_cb.addEventListener("change", styleListener);
size_cb.addEventListener("change", styleListener);
bold_button.addEventListener("click", styleListener);
italic_button.addEventListener("click", styleListener);
color_cb.addEventListener("change", styleListener);
function applyStyle(eventObj:Object) {
   Selection.setFocus("1");
   var my_fmt:TextFormat = text1.getTextFormat(_global.beginIndex);
   var my_fmt:TextFormat = text2.getTextFormat(_global.beginIndex);
   var my_fmt:TextFormat = text3.getTextFormat(_global.beginIndex);
   var my_fmt:TextFormat = text4.getTextFormat(_global.beginIndex);
   switch (eventObj.target._name) {
   case 'font_cb' :
      my_fmt.font = eventObj.target.selectedItem;
      break;
   case 'size_cb' :
      my_fmt.size = eventObj.target.selectedItem;
      break;
   case 'bold_button' :
      my_fmt.bold = !my_fmt.bold;
      break;
   case 'italic_button' :
      my_fmt.italic = !my_fmt.italic;
      break;
   case 'color_cb' :
      my_fmt.color = eventObj.target.selectedItem.data;
      break;
   }
   // reapply the text format.
   text1.setTextFormat(_global.beginIndex, _global.endIndex, my_fmt);
   text2.setTextFormat(_global.beginIndex, _global.endIndex, my_fmt);
   text3.setTextFormat(_global.beginIndex, _global.endIndex, my_fmt);
   text4.setTextFormat(_global.beginIndex, _global.endIndex, my_fmt);
}
// this function displays the current style at the beginning of the text selection.
viewStyle_button.addEventListener("click", clickListener);
function clickListener(eventObj:Object):Void {
   var curr_fmt:TextFormat = text1.getTextFormat(_global.beginIndex);
   var curr_fmt:TextFormat = text2.getTextFormat(_global.beginIndex);
   var curr_fmt:TextFormat = text3.getTextFormat(_global.beginIndex);
   var curr_fmt:TextFormat = text4.getTextFormat(_global.beginIndex);
   
}

Por Fernando_Salem

27 de clabLevel



Genero:Masculino  



Ultima edición por Fernando_Salem el 14 Feb 2007 06:27 pm, editado 1 vez

firefox
Citar            
MensajeEscrito el 14 Feb 2007 06:27 pm
por favor alguien que me heche una mano con este problema

Por Fernando_Salem

27 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 28 Feb 2007 02:05 pm
nadie me ayuda con esto?
por favor

Por Fernando_Salem

27 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 21 Ago 2007 01:25 pm
Estimado,

te cuento que yo estuve en este mismo problema dos días y despues de dormir muy poco y probar de TODO vengo a darme cuenta que para poder ver el resultado del setFocus es necesario exportar la pelicula... o sea si lo probas con el Clasico "Ctrl + Enter" NO FUNCIONA.

Espero haber ayudado.

Saludos

Por Martincho7

106 de clabLevel

1 tutorial

 

Montevideo, Uruguay

msie7
Citar            
MensajeEscrito el 30 Jun 2008 10:47 pm
como funcionaria entonces .

en as2 se carga el tipo de fotns.

var myFonts:Array = TextField.getFontList();
myFonts.sort();

combo.dataProvider = myFonts;


como cargo en un combobox la lista de font que yo quiero y no cargar todo solo cargar algunos como podria hacer eso ..???

Por zonwebperu

24 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 01 Jul 2008 09:54 pm
@Fernando_Salem para que puedas seleccionar un texto primero tienes que poner en foco el objeto flash con un click y despues poner en foco el textfield. Si se quiere utilizar setFocus enseguida que se cargue la página, el objeto flash debería estar en foco para que funcione, total que la solución está disponible solo en ie y es agregando al onload de la página focus(el id del objeto flash).

@zonwebperu, no viene tu pregunta al tema, pero ya tienes el arreglo myFonts, puedes reducirlo de tamaño eliminando variables de él y después lo asignas al comboBox.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox

 

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