Solved

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

Posted on 2003-10-21
7
193 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

747 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

14 Experts available now in Live!

Get 1:1 Help Now