Solved

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

Posted on 2003-10-21
7
196 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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…
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.

830 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