alias. .. se quiser o codigo completo, ai passo por anexo ... ;) 2009/5/13 Marcel Pigozzi <marcelpsara...@gmail.com>
> olha ... eu removi uma parte do codigo para nao ficar mto grande aqui rsrs > só pra vc ter uma ideia ;) > segue: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" > xmlns:containers="flexlib.mdi.containers.*" creationComplete="init();"> > > <mx:Script> > <![CDATA[ > import mx.controls.ComboBox; > import flashx.textLayout.compose.StandardFlowComposer; > import flashx.textLayout.conversion.TextFilter; > import flashx.textLayout.formats.CharacterFormat; > import flashx.textLayout.formats.ContainerFormat; > import flashx.textLayout.elements.TextFlow; > import flashx.textLayout.elements.ParagraphElement; > import flashx.textLayout.formats.ParagraphFormat; > import flashx.textLayout.edit.SelectionManager; > > > private var previousTextFormat:TextFormat = null; > private var textFormatChanged:Boolean = false; > private var invalidateToolBarFlag:Boolean = false; > private var lastCaretIndex:int = -1; > > var mainFlow:TextFlow; > var mainSelectionManager:SelectionManager; > var containerFormat:ContainerFormat; > var paragraphFormat:ParagraphFormat; > var paragraphElement:ParagraphElement; > var characterFormat:CharacterFormat; > > private function init():void { > > mainSelectionManager = new SelectionManager(); > > mainFlow = TextFilter.importToFlow(textArea.text, > TextFilter.TEXT_LAYOUT_FORMAT); > mainFlow.flowComposer = new StandardFlowComposer(); > mainFlow.interactionManager = mainSelectionManager; > > mainFlow.flowComposer.updateAllContainers(); > } > > private function setTextStyles(type:String, estilo:String, > value:Object=null):void { > var tf:TextFormat = new TextFormat(); > > var beginIndex:int = > textArea.getTextField().selectionBeginIndex; > var endIndex:int = > textArea.getTextField().selectionEndIndex; > > if(beginIndex == endIndex) { > tf = previousTextFormat; > } else { > tf = new TextFormat(); > } > > if(estilo == "fonte") { > > if(type == "bold" || type == "underline" || type == > "italic") { > tf[type] = value; > } else if(type == "font") { > tf[type] = fontFamilyCombo.text; > } else if(type == "size") { > var fontSize:uint = uint(fontSizeCombo.text); > if (fontSize > 0) > tf[type] = fontSize; > } else if (type == "color") { > tf[type] = uint(colorPicker.selectedColor); > } else if (type == "leading") { > tf[type] = nStpLinhas.value; > } else if (type == "align" || type == "bullet") { > tf[type] = value; > } > } else if(estilo == "pag") { > var beginIndex = > textArea.getTextField().getFirstCharInParagraph(beginIndex) - 1; > beginIndex = Math.max(0, beginIndex); > var endIndex = > textArea.getTextField().getFirstCharInParagraph(endIndex) + > > textArea.getTextField().getParagraphLength(endIndex) - 1; > > if(type == "letterSpacing") { > tf[type] = nStpLetras.value; > previousTextFormat.letterSpacing = > nStpLetras.value; > if (!endIndex) > textArea.getTextField().defaultTextFormat = > tf; > } > } > textFormatChanged = true; > > if(beginIndex == endIndex) { > previousTextFormat = tf; > } else { > > textArea.getTextField().setTextFormat(tf,beginIndex,endIndex); > } > } > > private function changeNoColumns():void { > containerFormat = new > ContainerFormat(mainFlow.containerFormat); > containerFormat.columnCount = Number(nStpColumn.value); > mainFlow.containerFormat = containerFormat; > mainFlow.flowComposer.updateAllContainers(); > } > > ]]> > </mx:Script> > > <containers:MDICanvas id="container" width="100%" height="100%"> > <containers:MDIWindow id="wind" title="Ferramentas" > width="300" height="200" alpha="0.7"> > > <mx:TabNavigator width="100%" height="100%" > selectedIndex="1"> > > <mx:VBox label="Exibição" > > <mx:HBox> > <mx:ToggleButtonBar id="alignButtons" > buttonWidth="20" > itemClick="setTextStyles('align', > 'fonte', > ToggleButtonBar(event.currentTarget).dataProvider.getItemAt(ToggleButtonBar(event.currentTarget).selectedIndex).action); > " > > <mx:dataProvider> > <mx:Array> > <mx:Object icon="" > action="left"/> > <mx:Object icon="" > action="center"/> > <mx:Object icon="" > action="right"/> > <mx:Object icon="" > action="justify"/> > </mx:Array> > </mx:dataProvider> > </mx:ToggleButtonBar> > > <mx:Button id="bulletButton" label="bullet" > width="20" toggle="true" > click="setTextStyles('bullet', > 'fonte', event.currentTarget.selected);" /> > > <mx:Label text="Esp. entre linhas" /> > <mx:NumericStepper id="nStpLinhas" > maximum="25" creationComplete="editarNroStep();" > change="setTextStyles('leading', > 'fonte');" /> > > </mx:HBox> > > <mx:HBox> > <mx:Label text="Esp. entre letras" /> > <mx:NumericStepper id="nStpLetras" maximum="25" > creationComplete="editarNroStep();" > change="setTextStyles('letterSpacing', > 'pag');" /> > </mx:HBox> > > <mx:NumericStepper id="nStpColumn" minimum="1" > maximum="4" > creationComplete="editarNroStep();" > change="changeNoColumns();" /> > > </mx:VBox> > > <mx:VBox label="Fontes" > > <mx:HBox> > <mx:Button id="btnBold" toggle="true" label="N" > fontWeight="bold" > click="setTextStyles('bold', 'fonte', > event.currentTarget.selected);" /> > <mx:Button id="btnSubl" toggle="true" label="S" > click="setTextStyles('underline', 'fonte', > event.currentTarget.selected);" /> > <mx:Button id="btnIta" toggle="true" label="I" > fontStyle="italic" > click="setTextStyles('italic', 'fonte', > event.currentTarget.selected);" /> > > </mx:HBox> > </mx:VBox> > > </mx:TabNavigator> > > </containers:MDIWindow> > > <mx:Panel id="panel" title="Document 1" height="100%" > horizontalCenter="0"> > <mx:TextArea id="textArea" condenseWhite="true" height="100%" > width="100%" > creationComplete="init();"/> > </mx:Panel> > > </containers:MDICanvas> > > </mx:Application> > > > 2009/5/13 André Caetano <andredeiv...@gmail.com> > >> cara se der coloque o codigo completo!!! >> >> >> >> >> > > > -- > Marcel Pigozzi > http://thegeekers.wordpress.com/ > > "Procure ser uma pessoa de valor, em vez de procurar ser uma pessoa de > sucesso. O sucesso é conseqüência" > -- Marcel Pigozzi http://thegeekers.wordpress.com/ "Procure ser uma pessoa de valor, em vez de procurar ser uma pessoa de sucesso. O sucesso é conseqüência" --~--~---------~--~----~------------~-------~--~----~ Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com Para sair da lista, envie um email em branco para flexdev-unsubscr...@googlegroups.com Mais opções estão disponíveis em http://groups.google.com/group/flexdev -~----------~----~----~----~------~----~------~--~---