Solved

identify text in red instead of text in black in a textarea

Posted on 2003-10-21
7
197 Views
Last Modified: 2010-04-03
Hi Everybody

I have a selectable textarea with black text.
I made a engine that changes the color of the words selected in red.
Now i need to store all the text in red into a variable.
Do you know if there is a method to do this?
0
Comment
Question by:BRX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9591558
How do you change te font color? When you select your text, push it inside an array element, for example..
0
 

Author Comment

by:BRX
ID: 9591613

onClipEvent(mouseUp){
      myFocus = Selection.getFocus();
      if(myFocus == "_level0.instance1.myText"){
            // Creo il formato per la selezione
            myTextFormat = new TextFormat();
            mioColore=eval("_parent._parent.colore"+_parent._parent.laSezione);
            myTextFormat.color = mioColore;
      
            inizio=selection.getBeginIndex();
            fine=selection.getEndIndex();
      
            _parent.myText.setTextFormat (inizio, fine, myTextFormat);
      }
}

I though to add this:
mySel = new Array();
mySel.push(inizio,fine);
_parent._parent.selectionArray.push(mySel);

but the problem is that the user could select the same text more times .... or can select a part of the text already selected... do you understand?

So I think that the best thing to do is to check all the text at the end and store the red one... but i don't' really know if this is possibile.


P.S. sei negative di Flash-mx.it?
se si rispondi in italiano

bye
0
 
LVL 27

Accepted Solution

by:
negatyve earned 50 total points
ID: 9591914
>P.S. sei negative di Flash-mx.it?

sono io.. :)

Ascolta, questa è la prima cosa che mi è venuta in mente. Sicuramente non è la migliore (è contorta, e vedo che c'è un semplice calcolo matematico dietro da dedurre), ma intanto basta a capire che direzione prendere. Cancella il tuo movieclip (non serve), e nello stesso frame in cui hai messo il campo di testo, scrivi:

this.myTextFormat = new TextFormat();
//this.myTextFormat.color = this._parent.colore[this._parent.laSezione];
this.myTextFormat.color = 0xFF0000;
this.origColor = this.myText.getTextFormat(0,1).color;

this.onMouseUp = function()
{
      if (Selection.getFocus() == "_level0.instance1.myText")
      this.myText.setTextFormat(Selection.getBeginIndex(), Selection.getEndIndex(), this.myTextFormat);
};
this.searchForEnd = function(index)
{
      for(var i = index; i < this.myText.text.length; i++){
            var col = this.myText.getTextFormat(i, i + 1).color;
            if(col == this.origColor)return i;
      }
      return this.myText.text.length;
};
bottone_btn.onRelease = function()
{
      var p = this._parent;
      p.selectionArray = [];
      for(var i = 0; i < p.myText.text.length; i++){
            var col = p.myText.getTextFormat(i, i + 1).color;
            if(col != p.origColor){
                  var e = p.searchForEnd(i);
                  p.selectionArray.push(p.myText.text.substring(i, e));
                  i = e;
            }
      }
};
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:BRX
ID: 9592151
Mi sembra che funzioni... ora sono cotto domattina gli do uno sguardo piu approfondito...
comunque grazie
0
 

Author Comment

by:BRX
ID: 9597520
Ciao Nega

sembra che il tutto funzioni... ti ringrazio

Ho un'altra semplice domanda.
Con MX non ho mai lavorato molto.
Metti che ho una timeline con un keyframe ogni dieci frame ( naturalmente con delgi stop()).
Con dei pulsanti do il gotoAndStop ("frameLabel").
Se volessi usare il metodo :

button.onRelease=function(){
  gotoAndStop ("frameLabel").
}

devo necessariamente scriverlo ogni dieci keyframe per ogni bottone??
oppure c'e' un metodo piu comodo??


P.S.
Siccome sono nuovo di questo forum... mi dici come funziona coi punti???
ora che mi hai risposto ti dovrei dare dei punti???

ciao

BRX
0
 

Author Comment

by:BRX
ID: 9597651
OK mi sono chiarito da solo l'idea per button.onRelease

se ti va di dirmi come funziona coi punti...

ciao
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9597669
Eccomi qua. Le istruzioni su come dare i punti sono qui: http://oldlook.experts-exchange.com/help/closing.jsp

In pratica devi cliccare sul pulsante Accept del commento che ritieni abbia risposto alla tua domanda. Quindi assegni un voto, A, B o c a seconda del tipo di risposta.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Embedding Flash App/Movie on Website 3 519
need a player that can play .d and .i DVR files 9 1,621
Adobe Flash Free Transform Tool 2 153
Flash ActionScript 6 78
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question