Solved

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

Posted on 2003-10-21
7
194 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now