[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2003-10-21
7
Medium Priority
?
200 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 150 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
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.

649 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