utility
AS3 Syntax Highlighting (with SyntaxHighlighter Evolved)
So apparently they changed the plugin name again and updated it to the latest (2.0.320) version of SyntaxHighlighter. I’ve also updated my brush to be more inline with how brushes are supposed to be made and be more of a replacement for the default AS3 brush now. Below is the download link for version 1.2 of my brush, I’m assuming the first two were 1.0 and 1.1 respectively.
Also included is an updated version of my theme, again changed to be more inline with how other themes were built. To use it with SyntaxHighlighter Evolved is more of a chore and directions can be seen here.
- Download and install SyntaxHighlighter Evolved
- Download my extension: shBrushAS3 (For version 2.0.320 of SyntaxHighlighter and as of the writing version 2.2.2 of SyntaxHighlighter Evolved)
- Place the script in SyntaxHighlighter’s Scripts directory.
- Use [ code language="as3"] … [ /code] to have your code highlighted (Spaces inserted into tags so SyntaxHighlighter doesn’t try to highlight them)
AS3 Syntax Highlighting (with SyntaxHighlighter-Plus)
As you have probably seen on a few of my posts I have syntax highlighted code. I previously was using a brush from http://www.digitalflipbook.com but the switch to Flash 10 left me wanting more. I updated the brush entirely and have the colors set to the default used in FlashDevelop. You can download the compressed and uncompressed version below. In order to use it on your WordPress blog:
Update: Fixed the RegEx’s regex so it wouldn’t highlight single line comments 1/27/09
Update2: Updated to version 1.0b2 of SyntaxHighlighter-Plus and with the upgrade to the SyntaxHighlighter 2 engine my brush is broken. Here is a link to the new version and old version. Also included in the new version is a CSS theme for the FlashDevelop syntax colors. 2/13/09
- Download and install SyntaxHighlighter-Plus
- Download my extension: Brush for v0.18 Brush for v1.0B2
- Place the compressed script in SyntaxHighlighter’s Scripts directory.
- To use this brush you will have to edit syntaxhighlighter.php and add the brush as an available brush to use. Navigate to around line 111, and add this line to the array:
'AS3' => array('as', 'actionscript', 'ActionScript', 'as3', 'AS3'), - Use [ code language="as3"] … [ /code] to have your code highlighted (Spaces inserted into tags so SyntaxHighlighter doesn’t try to highlight them)
Flash HTMLEntities Suck
So I ran into this issue at work where the client was trying to pass in HTML entities and expecting Flash to just take it in stride. Apparently Flash only handles about 5 different kinds of entities of the 300 or so. So to get around this I made a function to convert all the HTML entities to number entities. So if anyone else runs into this issue they can take advantage of this useful tool. Enjoy!
public function convertHTMLEntities(str:String):String {
var htmlEntities:Array = [" ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "ƒ", "Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "Σ", "Τ", "Υ", "Φ", "Χ", "Ψ", "Ω", "α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "ς", "σ", "τ", "υ", "φ", "χ", "ψ", "ω", "ϑ", "ϒ", "ϖ", "•", "…", "′", "″", "‾", "⁄", "℘", "ℑ", "ℜ", "™", "ℵ", "←", "↑", "→", "↓", "↔", "↵", "⇐", "⇑", "⇒", "⇓", "⇔", "∀", "∂", "∃", "∅", "∇", "∈", "∉", "∋", "∏", "∑", "−", "∗", "√", "∝", "∞", "∠", "∧", "∨", "∩", "∪", "∫", "∴", "∼", "≅", "≈", "≠", "≡", "≤", "≥", "⊂", "⊃", "⊄", "⊆", "⊇", "⊕", "⊗", "⊥", "⋅", "⌈", "⌉", "⌊", "⌋", "⟨", "⟩", "◊", "♠", "♣", "♥", "♦", "\"", "&", "<", ">", "Œ", "œ", "Š", "š", "Ÿ", "ˆ", "˜", " ", " ", " ", "‌", "‍", "‎", "‏", "–", "—", "‘", "’", "‚", "“", "”", "„", "†", "‡", "‰", "‹", "›", "€"];
var numberEntities:Array = [" ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "ƒ", "Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "Σ", "Τ", "Υ", "Φ", "Χ", "Ψ", "Ω", "α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "ς", "σ", "τ", "υ", "φ", "χ", "ψ", "ω", "ϑ", "ϒ", "ϖ", "•", "…", "′", "″", "‾", "⁄", "℘", "ℑ", "ℜ", "™", "ℵ", "←", "↑", "→", "↓", "↔", "↵", "⇐", "⇑", "⇒", "⇓", "⇔", "∀", "∂", "∃", "∅", "∇", "∈", "∉", "∋", "∏", "∑", "−", "∗", "√", "∝", "∞", "∠", "∧", "∨", "∩", "∪", "∫", "∴", "∼", "≅", "≈", "≠", "≡", "≤", "≥", "⊂", "⊃", "⊄", "⊆", "⊇", "⊕", "⊗", "⊥", "⋅", "⌈", "⌉", "⌊", "⌋", "〈", "〉", "◊", "♠", "♣", "♥", "♦", """, "&", "<", ">", "Œ", "œ", "Š", "š", "Ÿ", "ˆ", "˜", " ", " ", " ", "‌", "‍", "‎", "‏", "–", "—", "‘", "’", "‚", "“", "”", "„", "†", "‡", "‰", "‹", "›", "€"];
str = str.split("&").join("&");
var i:uint = htmlEntities.length;
while (i--) {
str = str.split(htmlEntities[i]).join(numberEntities[i]);
}
return new XMLDocument(str).firstChild.nodeValue;
}