To replace everywhere, use replace() with a RegExp and "g" option

style.replace (  / emphasized/g, "")  will replace all occurrences.
(not absolutely sure about the RegExp exact syntax).

Cf. 
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html#replace()

Maurice 

-----Message d'origine-----
De : Tianzhen Lin [mailto:tang...@usa.net] 
Envoyé : dimanche 20 octobre 2013 01:00
À : dev@flex.apache.org
Objet : RE: Odd SDK code in Spark button

Apparently "replace" only replaces the first occurrence of the string, so 
split/join is a more reliable route.

http://stackoverflow.com/questions/3214886/javascript-replace-only-replaces-
first-match

Tangent

p.s.  JavaScript is drunk.

-----Original Message-----
From: Justin Mclean [mailto:jus...@classsoftware.com]
Sent: Saturday, October 19, 2013 6:40 PM
To: dev@flex.apache.org
Subject: Odd SDK code in Spark button

HI,

Looking to see if join("") was used anywhere else found this:

        if (!styleName || styleName is String)
        {
            if (_emphasized)
                super.styleName = style + " emphasized";
            else 
                super.styleName = style.split(" emphasized").join("");
        } 

Would not be a performance bottle neck but why not just use replace?

Justin

Reply via email to