<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Jay Harris is Cpt. LoadTest - Flash</title>
    <link>http://www.cptloadtest.com/</link>
    <description>a .net developers blog on improving user experience of humans and coders</description>
    <language>en-us</language>
    <copyright>Jason Harris</copyright>
    <lastBuildDate>Fri, 12 Dec 2008 13:25:38 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.12105.0</generator>
    <managingEditor>jharris@harrisdesigns.com</managingEditor>
    <webMaster>jharris@harrisdesigns.com</webMaster>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=54e51040-72cb-4297-9012-bfaa4caa364f</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,54e51040-72cb-4297-9012-bfaa4caa364f.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,54e51040-72cb-4297-9012-bfaa4caa364f.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=54e51040-72cb-4297-9012-bfaa4caa364f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
My earlier post on creating custom brushes in Google Syntax Highlighter (<a title="Jay Harris, Blog Post: Extending Language Support in Google Syntax Highlighter" href="http://www.cptloadtest.com/2008/12/10/ExtendingLanguageSupportInGoogleSyntaxHighlighter.aspx">Extending
Language Support in Google Syntax Highlighter</a>) contains a rudimentary brush for
ActionScript. The original is designed for Stone Soup; it is something to get an AS
brush established, but is not meant to be exhaustive. I have revisited the brush and
added some meat. The bush should now supply a more thorough coverage of the language.
A download is provided below.
</p>
        <h3>ActionScript Brush
</h3>
        <pre class="js:nocontrols" name="code">dp.sh.Brushes.ActionScript = function() {
  var keywords = 'and arguments asfunction break call case catch clear ' +
    'continue default do else escape eval false finally for getProperty ' +
    'if ifFrameLoaded in instanceof loop NaN new newline not null or ' +
    'prototype return set super switch targetPath tellTarget this throw ' +
    'trace true try typeof undefined unescape var visible void while with';
  var builtin = '_currentframe _droptarget _framesloaded _global _height ' +
    '_level _name _root _rotation _target _totalframes _url _visible ' +
    '_width _x _xmouse _xscale _y _ymouse _yscale Array Boolean Button ' +
    'bytesLoaded bytesTotal Camera Color Date enabled Error focusEnabled ' +
    'Key LoadVars Math Mouse MovieClip nextFrame Number Object Selection ' +
    'Sound Stage String StyleSheet System TextFormat';
  var funcs = 'addProperty attachMovie attachVideo browse cancel ' +
    'clearInterval clone concat createEmptyMovieClip createTextField ' +
    'dispose draw duplicateMovieClip dynamic equals extends function ' +
    'getInstanceAtDepth gotoAndPlay gotoAndStop identity implements ' +
    'import interface isEmpty isFinite isNAN join length loadClip ' +
    'loadMovie loadMovieNum loadVariables loadVariablesNum merge moveTo ' +
    'on onClipEvent onDragOut onDragOver onEnterFrame onKeyDown onKeyUp ' +
    'onKillFocus onMouseDown onMouseMove onMouseUp onPress onRelease ' +
    'onReleaseOutside onRollOut onRollOver onUnload play pop prevFrame ' +
    'private public push registerClass removeMovieClip reverse rotate ' +
    'scale setEmpty setInterval setProperty shift slice sort sortOn ' +
    'splice startDrag static stopAllSounds stopDrag subtract swapDepths ' +
    'toString toString translate union unloadClip unloadMovie ' +
    'unloadMovieNum unshiftclass unwatch valueOf watch';
  var includes = '#include #initClip #endInitClip';

  this.regexList = [
    {regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' },
    {regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' },
    {regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' },
    {regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' },
    {regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' },
    {regex: new RegExp(this.GetKeywords(funcs), 'gm'), css: 'func' },
    {regex: new RegExp(this.GetKeywords(builtin), 'gm'), css: 'builtin' },
    {regex: new RegExp(this.GetKeywords(includes), 'gm'), css: 'preprocessor'}
  ];
  this.CssClass = 'dp-as';
  this.Style = '.dp-as .func { color: #000099; }' +
               '.dp-as .builtin { color: #990000; }';
}

dp.sh.Brushes.ActionScript.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.ActionScript.Aliases = ['actionscript', 'as'];</pre>
        <h3>Usage
</h3>
        <p>
Upload the Brush javascript file to your Google Syntax Highlighter <em>Scripts</em> directory,
and load the file in unto your HTML with a &lt;SCRIPT&gt; tag with your other brushes.
</p>
        <pre class="html:nogutter:nocontrols" name="code">&lt;script language="javascript"
  src="dp.SyntaxHighlighter/Scripts/shBrushAs.js"&gt;&lt;/script&gt;</pre>
        <p>
Display syntax-highlighted ActionScript using a traditional Google Syntax Highlighter
&lt;PRE&gt; tag, using <em>as</em> or <em>actionscript</em> as the language alias.
</p>
        <pre class="html:nogutter:nocontrols" name="code">&lt;pre name="code" class="as"&gt;
  // Some ActionScript Code
&lt;/pre&gt;</pre>
        <h3>Brush In Action
</h3>
        <pre class="as:nocontrols" name="code">/*
Sample ActionScript for Demo
ActionScript Brush for Google Syntax Highlighter
*/
if (dteDate.getMonth() == intCurrMonth &amp;&amp; intCurrMonth == intOldMonth
    &amp;&amp; intOldYear == intCurrYear) {
  if (dteDate.getDay() == 0 and dteDate.getDate()&gt;1) {
    intYPosition = intYPosition+20;
  }
  duplicateMovieClip ("DayContainer", "DayContainer"+intDate, intDate);
  setProperty ("DayContainer"+intDate, _y, intYPosition);
  setProperty ("DayContainer"+intDate, _x, intXPosition[dteDate.getDay()]);

  } else if (intCurrMonth == 6) {
    if (intDate == 4) {
      clrFColor = new Color("DayContainer"+intDate+".foreground");
      clrFColor.setRGB(0xFF0000);
      clrBColor = new Color("DayContainer"+intDate+".background");
      clrBColor.setRGB(0xFF0000);
    }
  } else if (intCurrMonth == 9) {
    if (intDate == 31) {
      clrFColor = new Color("DayContainer"+intDate+".foreground");
      clrFColor.setRGB(0xFF9922);
      clrBColor = new Color("DayContainer"+intDate+".background");
      clrBColor.setRGB(0xFF9922);
    }
  } else if (intCurrMonth == 10) {
    if (intDate &gt;= 22 &amp;&amp; intDate &lt;= 28 &amp;&amp; dteDate.getDay() == 4) {
      clrFColor = new Color("DayContainer"+intDate+".foreground");
      clrFColor.setRGB(0xFFCC00);
      clrBColor = new Color("DayContainer"+intDate+".background");
      clrBColor.setRGB(0xFFCC00);
    }
  set ("DayContainer"+intDate+":MyDate", new Date(dteDate.getFullYear(),
    dteDate.getMonth(), dteDate.getDate()));
  setProperty ("DayContainer"+intDate, _visible, true);
  intDate++;
  dteDate.setDate(intDate);
}</pre>
        <h3>Download
</h3>
        <blockquote>
          <p>
            <strong>Download:</strong>
            <a title="ActionScript Brush for Google Syntax Highlighter" href="http://www.cptloadtest.com/content/binary/shBrushAs.zip">shBrushAs.zip</a>
            <br />
Includes:
</p>
          <ul>
            <li>
Compressed <em>shBrushAs.js</em> for production.  
</li>
            <li>
Uncompressed <em>shBurshAs.js</em> for debugging.</li>
          </ul>
          <p>
As always, this code is provided with no warranties or guarantees. Use at your own
risk. Your mileage may vary.
</p>
        </blockquote>
        <pre>
          <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a7707e63-5a44-4a88-b27c-59fab2383def" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati
Tags: <a href="http://technorati.com/tags/Google%20Code" rel="tag">Google Code</a>,<a href="http://technorati.com/tags/SyntaxHighlighter" rel="tag">SyntaxHighlighter</a>,<a href="http://technorati.com/tags/Syntax%20Highlighter" rel="tag">Syntax
Highlighter</a>,<a href="http://technorati.com/tags/ActionScript" rel="tag">ActionScript</a></div>
        </pre>
        <pre> </pre>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=54e51040-72cb-4297-9012-bfaa4caa364f" />
      </body>
      <title>ActionScript Brush for Google Syntax Highlighter</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,54e51040-72cb-4297-9012-bfaa4caa364f.aspx</guid>
      <link>http://www.cptloadtest.com/2008/12/12/ActionScript-Brush-For-Google-Syntax-Highlighter.aspx</link>
      <pubDate>Fri, 12 Dec 2008 13:25:38 GMT</pubDate>
      <description>&lt;p&gt;
My earlier post on creating custom brushes in Google Syntax Highlighter (&lt;a title="Jay Harris, Blog Post: Extending Language Support in Google Syntax Highlighter" href="http://www.cptloadtest.com/2008/12/10/ExtendingLanguageSupportInGoogleSyntaxHighlighter.aspx"&gt;Extending
Language Support in Google Syntax Highlighter&lt;/a&gt;) contains a rudimentary brush for
ActionScript. The original is designed for Stone Soup; it is something to get an AS
brush established, but is not meant to be exhaustive. I have revisited the brush and
added some meat. The bush should now supply a more thorough coverage of the language.
A download is provided below.
&lt;/p&gt;
&lt;h3&gt;ActionScript Brush
&lt;/h3&gt;
&lt;pre class="js:nocontrols" name="code"&gt;dp.sh.Brushes.ActionScript = function() {
  var keywords = 'and arguments asfunction break call case catch clear ' +
    'continue default do else escape eval false finally for getProperty ' +
    'if ifFrameLoaded in instanceof loop NaN new newline not null or ' +
    'prototype return set super switch targetPath tellTarget this throw ' +
    'trace true try typeof undefined unescape var visible void while with';
  var builtin = '_currentframe _droptarget _framesloaded _global _height ' +
    '_level _name _root _rotation _target _totalframes _url _visible ' +
    '_width _x _xmouse _xscale _y _ymouse _yscale Array Boolean Button ' +
    'bytesLoaded bytesTotal Camera Color Date enabled Error focusEnabled ' +
    'Key LoadVars Math Mouse MovieClip nextFrame Number Object Selection ' +
    'Sound Stage String StyleSheet System TextFormat';
  var funcs = 'addProperty attachMovie attachVideo browse cancel ' +
    'clearInterval clone concat createEmptyMovieClip createTextField ' +
    'dispose draw duplicateMovieClip dynamic equals extends function ' +
    'getInstanceAtDepth gotoAndPlay gotoAndStop identity implements ' +
    'import interface isEmpty isFinite isNAN join length loadClip ' +
    'loadMovie loadMovieNum loadVariables loadVariablesNum merge moveTo ' +
    'on onClipEvent onDragOut onDragOver onEnterFrame onKeyDown onKeyUp ' +
    'onKillFocus onMouseDown onMouseMove onMouseUp onPress onRelease ' +
    'onReleaseOutside onRollOut onRollOver onUnload play pop prevFrame ' +
    'private public push registerClass removeMovieClip reverse rotate ' +
    'scale setEmpty setInterval setProperty shift slice sort sortOn ' +
    'splice startDrag static stopAllSounds stopDrag subtract swapDepths ' +
    'toString toString translate union unloadClip unloadMovie ' +
    'unloadMovieNum unshiftclass unwatch valueOf watch';
  var includes = '#include #initClip #endInitClip';

  this.regexList = [
    {regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' },
    {regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' },
    {regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' },
    {regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' },
    {regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' },
    {regex: new RegExp(this.GetKeywords(funcs), 'gm'), css: 'func' },
    {regex: new RegExp(this.GetKeywords(builtin), 'gm'), css: 'builtin' },
    {regex: new RegExp(this.GetKeywords(includes), 'gm'), css: 'preprocessor'}
  ];
  this.CssClass = 'dp-as';
  this.Style = '.dp-as .func { color: #000099; }' +
               '.dp-as .builtin { color: #990000; }';
}

dp.sh.Brushes.ActionScript.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.ActionScript.Aliases = ['actionscript', 'as'];&lt;/pre&gt;
&lt;h3&gt;Usage
&lt;/h3&gt;
&lt;p&gt;
Upload the Brush javascript file to your Google Syntax Highlighter &lt;em&gt;Scripts&lt;/em&gt; directory,
and load the file in unto your HTML with a &amp;lt;SCRIPT&amp;gt; tag with your other brushes.
&lt;/p&gt;
&lt;pre class="html:nogutter:nocontrols" name="code"&gt;&amp;lt;script language="javascript"
  src="dp.SyntaxHighlighter/Scripts/shBrushAs.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;
Display syntax-highlighted ActionScript using a traditional Google Syntax Highlighter
&amp;lt;PRE&amp;gt; tag, using &lt;em&gt;as&lt;/em&gt; or &lt;em&gt;actionscript&lt;/em&gt; as the language alias.
&lt;/p&gt;
&lt;pre class="html:nogutter:nocontrols" name="code"&gt;&amp;lt;pre name="code" class="as"&amp;gt;
  // Some ActionScript Code
&amp;lt;/pre&amp;gt;&lt;/pre&gt;
&lt;h3&gt;Brush In Action
&lt;/h3&gt;
&lt;pre class="as:nocontrols" name="code"&gt;/*
Sample ActionScript for Demo
ActionScript Brush for Google Syntax Highlighter
*/
if (dteDate.getMonth() == intCurrMonth &amp;amp;&amp;amp; intCurrMonth == intOldMonth
    &amp;amp;&amp;amp; intOldYear == intCurrYear) {
  if (dteDate.getDay() == 0 and dteDate.getDate()&amp;gt;1) {
    intYPosition = intYPosition+20;
  }
  duplicateMovieClip ("DayContainer", "DayContainer"+intDate, intDate);
  setProperty ("DayContainer"+intDate, _y, intYPosition);
  setProperty ("DayContainer"+intDate, _x, intXPosition[dteDate.getDay()]);

  } else if (intCurrMonth == 6) {
    if (intDate == 4) {
      clrFColor = new Color("DayContainer"+intDate+".foreground");
      clrFColor.setRGB(0xFF0000);
      clrBColor = new Color("DayContainer"+intDate+".background");
      clrBColor.setRGB(0xFF0000);
    }
  } else if (intCurrMonth == 9) {
    if (intDate == 31) {
      clrFColor = new Color("DayContainer"+intDate+".foreground");
      clrFColor.setRGB(0xFF9922);
      clrBColor = new Color("DayContainer"+intDate+".background");
      clrBColor.setRGB(0xFF9922);
    }
  } else if (intCurrMonth == 10) {
    if (intDate &amp;gt;= 22 &amp;amp;&amp;amp; intDate &amp;lt;= 28 &amp;amp;&amp;amp; dteDate.getDay() == 4) {
      clrFColor = new Color("DayContainer"+intDate+".foreground");
      clrFColor.setRGB(0xFFCC00);
      clrBColor = new Color("DayContainer"+intDate+".background");
      clrBColor.setRGB(0xFFCC00);
    }
  set ("DayContainer"+intDate+":MyDate", new Date(dteDate.getFullYear(),
    dteDate.getMonth(), dteDate.getDate()));
  setProperty ("DayContainer"+intDate, _visible, true);
  intDate++;
  dteDate.setDate(intDate);
}&lt;/pre&gt;
&lt;h3&gt;Download
&lt;/h3&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Download:&lt;/strong&gt; &lt;a title="ActionScript Brush for Google Syntax Highlighter" href="http://www.cptloadtest.com/content/binary/shBrushAs.zip"&gt;shBrushAs.zip&lt;/a&gt;
&lt;br&gt;
Includes:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Compressed &lt;em&gt;shBrushAs.js&lt;/em&gt; for production.&amp;nbsp; 
&lt;li&gt;
Uncompressed &lt;em&gt;shBurshAs.js&lt;/em&gt; for debugging.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
As always, this code is provided with no warranties or guarantees. Use at your own
risk. Your mileage may vary.
&lt;/p&gt;
&lt;/blockquote&gt;&lt;pre&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a7707e63-5a44-4a88-b27c-59fab2383def" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati
Tags: &lt;a href="http://technorati.com/tags/Google%20Code" rel="tag"&gt;Google Code&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SyntaxHighlighter" rel="tag"&gt;SyntaxHighlighter&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Syntax%20Highlighter" rel="tag"&gt;Syntax
Highlighter&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ActionScript" rel="tag"&gt;ActionScript&lt;/a&gt;
&lt;/div&gt;
&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=54e51040-72cb-4297-9012-bfaa4caa364f" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,54e51040-72cb-4297-9012-bfaa4caa364f.aspx</comments>
      <category>Blogging</category>
      <category>Flash</category>
      <category>Programming</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As I discussed in an earlier post (<a title="Jay Harris, Blog Post: Blog your code using Google Syntax Highlighter" href="http://www.cptloadtest.com/2008/11/24/BlogYourCodeUsingGoogleSyntaxHighlighter.aspx">Blog
your code using Google Syntax Highlighter</a>), Google Syntax Highlighter is a simple
tool that allows bloggers to easily display code in a format that is familiar end
users. The tool renders the code in a very consumable fashion that includes colored
syntax highlighting, line highlighting, and line numbers. Out of the box it supports
most of the common languages of today, and a few from yesterday, but some common languages
are unsupported. Perl, ColdFusion, and Flash's ActionScript all are unloved by Google
Syntax Highlighter, as are many others that you may want to post to your blog. For
these languages, the solution is a custom brush.
</p>
        <h3>Syntax Highlighting Brushes
</h3>
        <p>
For Google Syntax Highlighter, brushes are JavaScript files that govern the syntax
highlighting process, with names following the format of shBrushLanguage.js, such
as shBrushXml.js. Brushes contain information about the keywords, functions, and operators
of a language, as well as the syntax for comments, strings, and other syntax characteristics.
Keyword-level syntax is applied to any specific word in the language, including keywords,
functions, and any word operators, such as <em>and</em>, <em>or</em>, and <em>not</em>.
Regular expressions apply character-level syntax to code, and identifies items such
as character operators, the remainder of an inline comment, or the entire contents
of a comment block. Finally, aliases are defined for the brush; these are the language
aliases that are used within the <em>class</em> attribute of the Google Syntax Highlighter
&lt;PRE&gt; tag. With this information, the brush applies the syntax highlighting
styles according to the CSS defined for each component of the language. 
</p>
        <h3>Breaking Down Brushes
</h3>
        <h4>Decomposing the SQL Brush
</h4>
        <p>
In JavaScript, everything is an object that can be assigned to a variable, whether
its a number, string, function, or class. Brushes are each a delegate function. The
variable name of the brush must match <em>dp.sh.Brushes.SomeLanguage</em>.
</p>
        <pre class="js:nocontrols:firstline[1]" name="code">dp.sh.Brushes.Sql = function() {</pre>
        <p>
Next, define the list of keywords for applying syntax highlighting. Each list is not
an array, but rather a single-space delimited string of keywords that will be highlighted.
Also, multiple keyword lists can exist, such as one list for function names, another
for keywords, and perhaps another for types, and unique styling can be applied to
each grouping (we'll get to styling a little later). 
</p>
        <pre class="js:nocontrols:firstline[2]" name="code">  var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
    'current_user day isnull left lower month nullif replace right ' +
    'session_user space substring sum system_user upper user year';

  var keywords = 'absolute action add after alter as asc at authorization ' +
    'begin bigint binary bit by cascade char character check checkpoint ' +
    'close collate column commit committed connect connection constraint ' +
    'contains continue create cube current current_date current_time ' +
    'cursor database date deallocate dec decimal declare default delete ' +
    'desc distinct double drop dynamic else end end-exec escape except ' +
    'exec execute false fetch first float for force foreign forward free ' +
    'from full function global goto grant group grouping having hour ' +
    'ignore index inner insensitive insert instead int integer intersect ' +
    'into is isolation key last level load local max min minute modify ' +
    'move name national nchar next no numeric of off on only open option ' +
    'order out output partial password precision prepare primary prior ' +
    'privileges procedure public read real references relative repeatable ' +
    'restrict return returns revoke rollback rollup rows rule schema ' +
    'scroll second section select sequence serializable set size smallint ' +
    'static statistics table temp temporary then time timestamp to top ' +
    'transaction translation trigger true truncate uncommitted union ' +
    'unique update values varchar varying view when where with work';

  var operators = 'all and any between cross in join like not null or ' +
    'outer some';</pre>
        <p>
Following the keyword definitions is the Regular Expression pattern and Style definition
object list. The list, <em>this.regexList</em>, is an array of pattern/style objects: <em>{regex:
regexPattern, css: classString}</em>. The <em>regexPattern</em> is a JavaScript <em>RegExp</em> object,
and defines the pattern to match in the source code; this pattern can be created using
one of three options within Google Syntax Highlighter. 
</p>
        <dl>
          <dt>Predefined Patterns </dt>
          <dd>Within Google Syntax Highlighter, <em>dp.sh.RegexLib</em> contains five predefined
regular expression patterns. <em>MultiLineCComments</em> is used for any language
that uses C-style multi-line comment blocks: <em>/* my comment block */</em>. <em>SingleLineCComments</em> is
used for any language that uses C-style single line or inline comments: <em>// my
comment</em>. <em>SingleLinePerlComments</em> applies for Perl-style single line comments: <em>#
my comment</em>. <em>DoubleQuotedString</em> identifies any string wrapped in double-quotes
and <em>SingleQuotedString</em> identifies strings wrapped in single-quotes. These
options are used in place of creating a new instance of the <em>RegExp</em> object. 
</dd>
          <dt>Keyword Patterns </dt>
          <dd>Google Syntax Highlighter has a <em>GetKeywords(string)</em> function which will
build a pattern string based on one of the brush's defined keyword strings. However,
this is only the pattern string, and not the <em>RegExp</em> object. Pass this value
into the <em>RegExp</em> constructor: <em>new RegExp(this.GetKeyword(keywords), 'gmi')</em></dd>
          <dt>Custom Pattern Definition </dt>
          <dd>Create a new <em>RegExp</em> object using a custom pattern. For example, use <em>new
RegExp('--(.*)$', 'gm')</em> to match all Sql comments, such as <em>--my comment</em>.</dd>
        </dl>
        <p>
For these pattern/style objects, the regular expression pattern is followed by the
name of the CSS class to apply to any regular expression matches. The style sheet
packaged with Google Syntax Highlighter, SyntaxHighlighter.css, already defines the
many CSS classes used by GSH; place the additional styles for your custom brushes
within this file, in a new file, in your HTML, or defined them within the brush using
JavaScript.
</p>
        <pre class="js:nocontrols:firstline[27]" name="code">  this.regexList = [
    {regex: new RegExp('--(.*)$', 'gm'), css: 'comment'},
    {regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string'},
    {regex: dp.sh.RegexLib.SingleQuotedString, css: 'string'},
    {regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'func'},
    {regex: new RegExp(this.GetKeywords(operators), 'gmi'), css: 'op'},
    {regex: new RegExp(this.GetKeywords(keywords), 'gmi'), css: 'keyword'}
  ];</pre>
        <p>
The delegate definition ends with any style specifications. Apply a style sheet to
the entire code block using <em>this.CssClass</em>. Also, as mentioned above, the
brush can define custom CSS using this.Style as an alternative to placing the CSS
in HTML or a CSS file. When finished, close the delegate.
</p>
        <pre class="js:nocontrols:firstline[36]" name="code">  this.CssClass = 'dp-sql';
  this.Style = '.dp-sql .func { color: #ff1493; }' +
    '.dp-sql .op { color: #808080; }'; }
</pre>
        <p>
The final component of a Brush, set outside of your delegate, contains the prototype
declaration and any aliases to apply to the Brush. Aliases consist of a string array
(a real array this time, not a space-delimited string) of language aliases to use,
such as ['c#','c-sharp','csharp']. Alias values must be unique across all defined
brushes that you have included into your site.
</p>
        <pre class="js:nocontrols:firstline[40]" name="code">dp.sh.Brushes.Sql.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.Sql.Aliases = ['sql'];</pre>
        <h3>Making a Custom Brush (for ActionScript) 
</h3>
        <p>
I like rich media applications, such as those developed in Flash or Silverlight. I
was surprised when I found that Google Syntax Highlighter does not ship with an ActionScript
brush, and more surprised when I found out that no one has written one, yet. So, using
the methods from above, I created one. This isn't meant to be an exhaustive brush,
but more like <a href="http://en.wikipedia.org/wiki/Stone_soup">Stone Soup</a>. It's
a start. Please feel free to add to it.
</p>
        <pre class="js" name="code">dp.sh.Brushes.ActionScript = function() {

  var keywords = 'and break case catch class continue default do dynamic else ' +
    'extends false finally for if implements import in interface NaN new not ' +
    'null or private public return static super switch this throw true try ' +
    'undefined var void while with';

  this.regexList = [{regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment'},
    {regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment'},
    {regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string'},
    {regex: dp.sh.RegexLib.SingleQuotedString, css: 'string'},
    {regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword'}];

    this.CssClass = 'dp-as';
}

dp.sh.Brushes.ActionScript.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.ActionScript.Aliases = ['actionscript', 'as'];</pre>
        <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:51b61cce-ee33-4c5c-9de4-a3c6cf350c46" style="margin: 0px; padding: 0px; display: inline;">Technorati
Tags: <a href="http://technorati.com/tags/Syntax%20Highlighter" rel="tag">Syntax Highlighter</a>,<a href="http://technorati.com/tags/SyntaxHighlighter" rel="tag">SyntaxHighlighter</a>,<a href="http://technorati.com/tags/Google%20Code" rel="tag">Google
Code</a>,<a href="http://technorati.com/tags/ActionScript" rel="tag">ActionScript</a></div>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9" />
      </body>
      <title>Extending Language Support in Google Syntax Highlighter</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9.aspx</guid>
      <link>http://www.cptloadtest.com/2008/12/10/Extending-Language-Support-In-Google-Syntax-Highlighter.aspx</link>
      <pubDate>Wed, 10 Dec 2008 21:47:27 GMT</pubDate>
      <description>&lt;p&gt;
As I discussed in an earlier post (&lt;a title="Jay Harris, Blog Post: Blog your code using Google Syntax Highlighter" href="http://www.cptloadtest.com/2008/11/24/BlogYourCodeUsingGoogleSyntaxHighlighter.aspx"&gt;Blog
your code using Google Syntax Highlighter&lt;/a&gt;), Google Syntax Highlighter is a simple
tool that allows bloggers to easily display code in a format that is familiar end
users. The tool renders the code in a very consumable fashion that includes colored
syntax highlighting, line highlighting, and line numbers. Out of the box it supports
most of the common languages of today, and a few from yesterday, but some common languages
are unsupported. Perl, ColdFusion, and Flash's ActionScript all are unloved by Google
Syntax Highlighter, as are many others that you may want to post to your blog. For
these languages, the solution is a custom brush.
&lt;/p&gt;
&lt;h3&gt;Syntax Highlighting Brushes
&lt;/h3&gt;
&lt;p&gt;
For Google Syntax Highlighter, brushes are JavaScript files that govern the syntax
highlighting process, with names following the format of shBrushLanguage.js, such
as shBrushXml.js. Brushes contain information about the keywords, functions, and operators
of a language, as well as the syntax for comments, strings, and other syntax characteristics.
Keyword-level syntax is applied to any specific word in the language, including keywords,
functions, and any word operators, such as &lt;em&gt;and&lt;/em&gt;, &lt;em&gt;or&lt;/em&gt;, and &lt;em&gt;not&lt;/em&gt;.
Regular expressions apply character-level syntax to code, and identifies items such
as character operators, the remainder of an inline comment, or the entire contents
of a comment block. Finally, aliases are defined for the brush; these are the language
aliases that are used within the &lt;em&gt;class&lt;/em&gt; attribute of the Google Syntax Highlighter
&amp;lt;PRE&amp;gt; tag. With this information, the brush applies the syntax highlighting
styles according to the CSS defined for each component of the language. 
&lt;/p&gt;
&lt;h3&gt;Breaking Down Brushes
&lt;/h3&gt;
&lt;h4&gt;Decomposing the SQL Brush
&lt;/h4&gt;
&lt;p&gt;
In JavaScript, everything is an object that can be assigned to a variable, whether
its a number, string, function, or class. Brushes are each a delegate function. The
variable name of the brush must match &lt;em&gt;dp.sh.Brushes.SomeLanguage&lt;/em&gt;.
&lt;/p&gt;
&lt;pre class="js:nocontrols:firstline[1]" name="code"&gt;dp.sh.Brushes.Sql = function() {&lt;/pre&gt;
&lt;p&gt;
Next, define the list of keywords for applying syntax highlighting. Each list is not
an array, but rather a single-space delimited string of keywords that will be highlighted.
Also, multiple keyword lists can exist, such as one list for function names, another
for keywords, and perhaps another for types, and unique styling can be applied to
each grouping (we'll get to styling a little later). 
&lt;/p&gt;
&lt;pre class="js:nocontrols:firstline[2]" name="code"&gt;  var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
    'current_user day isnull left lower month nullif replace right ' +
    'session_user space substring sum system_user upper user year';

  var keywords = 'absolute action add after alter as asc at authorization ' +
    'begin bigint binary bit by cascade char character check checkpoint ' +
    'close collate column commit committed connect connection constraint ' +
    'contains continue create cube current current_date current_time ' +
    'cursor database date deallocate dec decimal declare default delete ' +
    'desc distinct double drop dynamic else end end-exec escape except ' +
    'exec execute false fetch first float for force foreign forward free ' +
    'from full function global goto grant group grouping having hour ' +
    'ignore index inner insensitive insert instead int integer intersect ' +
    'into is isolation key last level load local max min minute modify ' +
    'move name national nchar next no numeric of off on only open option ' +
    'order out output partial password precision prepare primary prior ' +
    'privileges procedure public read real references relative repeatable ' +
    'restrict return returns revoke rollback rollup rows rule schema ' +
    'scroll second section select sequence serializable set size smallint ' +
    'static statistics table temp temporary then time timestamp to top ' +
    'transaction translation trigger true truncate uncommitted union ' +
    'unique update values varchar varying view when where with work';

  var operators = 'all and any between cross in join like not null or ' +
    'outer some';&lt;/pre&gt;
&lt;p&gt;
Following the keyword definitions is the Regular Expression pattern and Style definition
object list. The list, &lt;em&gt;this.regexList&lt;/em&gt;, is an array of pattern/style objects: &lt;em&gt;{regex:
regexPattern, css: classString}&lt;/em&gt;. The &lt;em&gt;regexPattern&lt;/em&gt; is a JavaScript &lt;em&gt;RegExp&lt;/em&gt; object,
and defines the pattern to match in the source code; this pattern can be created using
one of three options within Google Syntax Highlighter. 
&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;Predefined Patterns &lt;/dt&gt;
&lt;dd&gt;Within Google Syntax Highlighter, &lt;em&gt;dp.sh.RegexLib&lt;/em&gt; contains five predefined
regular expression patterns. &lt;em&gt;MultiLineCComments&lt;/em&gt; is used for any language
that uses C-style multi-line comment blocks: &lt;em&gt;/* my comment block */&lt;/em&gt;. &lt;em&gt;SingleLineCComments&lt;/em&gt; is
used for any language that uses C-style single line or inline comments: &lt;em&gt;// my
comment&lt;/em&gt;. &lt;em&gt;SingleLinePerlComments&lt;/em&gt; applies for Perl-style single line comments: &lt;em&gt;#
my comment&lt;/em&gt;. &lt;em&gt;DoubleQuotedString&lt;/em&gt; identifies any string wrapped in double-quotes
and &lt;em&gt;SingleQuotedString&lt;/em&gt; identifies strings wrapped in single-quotes. These
options are used in place of creating a new instance of the &lt;em&gt;RegExp&lt;/em&gt; object. 
&lt;/dd&gt;
&lt;dt&gt;Keyword Patterns &lt;/dt&gt;
&lt;dd&gt;Google Syntax Highlighter has a &lt;em&gt;GetKeywords(string)&lt;/em&gt; function which will
build a pattern string based on one of the brush's defined keyword strings. However,
this is only the pattern string, and not the &lt;em&gt;RegExp&lt;/em&gt; object. Pass this value
into the &lt;em&gt;RegExp&lt;/em&gt; constructor: &lt;em&gt;new RegExp(this.GetKeyword(keywords), 'gmi')&lt;/em&gt; 
&lt;/dd&gt;
&lt;dt&gt;Custom Pattern Definition &lt;/dt&gt;
&lt;dd&gt;Create a new &lt;em&gt;RegExp&lt;/em&gt; object using a custom pattern. For example, use &lt;em&gt;new
RegExp('--(.*)$', 'gm')&lt;/em&gt; to match all Sql comments, such as &lt;em&gt;--my comment&lt;/em&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;
For these pattern/style objects, the regular expression pattern is followed by the
name of the CSS class to apply to any regular expression matches. The style sheet
packaged with Google Syntax Highlighter, SyntaxHighlighter.css, already defines the
many CSS classes used by GSH; place the additional styles for your custom brushes
within this file, in a new file, in your HTML, or defined them within the brush using
JavaScript.
&lt;/p&gt;
&lt;pre class="js:nocontrols:firstline[27]" name="code"&gt;  this.regexList = [
    {regex: new RegExp('--(.*)$', 'gm'), css: 'comment'},
    {regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string'},
    {regex: dp.sh.RegexLib.SingleQuotedString, css: 'string'},
    {regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'func'},
    {regex: new RegExp(this.GetKeywords(operators), 'gmi'), css: 'op'},
    {regex: new RegExp(this.GetKeywords(keywords), 'gmi'), css: 'keyword'}
  ];&lt;/pre&gt;
&lt;p&gt;
The delegate definition ends with any style specifications. Apply a style sheet to
the entire code block using &lt;em&gt;this.CssClass&lt;/em&gt;. Also, as mentioned above, the
brush can define custom CSS using this.Style as an alternative to placing the CSS
in HTML or a CSS file. When finished, close the delegate.
&lt;/p&gt;
&lt;pre class="js:nocontrols:firstline[36]" name="code"&gt;  this.CssClass = 'dp-sql';
  this.Style = '.dp-sql .func { color: #ff1493; }' +
    '.dp-sql .op { color: #808080; }'; }
&lt;/pre&gt;
&lt;p&gt;
The final component of a Brush, set outside of your delegate, contains the prototype
declaration and any aliases to apply to the Brush. Aliases consist of a string array
(a real array this time, not a space-delimited string) of language aliases to use,
such as ['c#','c-sharp','csharp']. Alias values must be unique across all defined
brushes that you have included into your site.
&lt;/p&gt;
&lt;pre class="js:nocontrols:firstline[40]" name="code"&gt;dp.sh.Brushes.Sql.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.Sql.Aliases = ['sql'];&lt;/pre&gt;
&lt;h3&gt;Making a Custom Brush (for ActionScript) 
&lt;/h3&gt;
&lt;p&gt;
I like rich media applications, such as those developed in Flash or Silverlight. I
was surprised when I found that Google Syntax Highlighter does not ship with an ActionScript
brush, and more surprised when I found out that no one has written one, yet. So, using
the methods from above, I created one. This isn't meant to be an exhaustive brush,
but more like &lt;a href="http://en.wikipedia.org/wiki/Stone_soup"&gt;Stone Soup&lt;/a&gt;. It's
a start. Please feel free to add to it.
&lt;/p&gt;
&lt;pre class="js" name="code"&gt;dp.sh.Brushes.ActionScript = function() {

  var keywords = 'and break case catch class continue default do dynamic else ' +
    'extends false finally for if implements import in interface NaN new not ' +
    'null or private public return static super switch this throw true try ' +
    'undefined var void while with';

  this.regexList = [{regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment'},
    {regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment'},
    {regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string'},
    {regex: dp.sh.RegexLib.SingleQuotedString, css: 'string'},
    {regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword'}];

    this.CssClass = 'dp-as';
}

dp.sh.Brushes.ActionScript.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.ActionScript.Aliases = ['actionscript', 'as'];&lt;/pre&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:51b61cce-ee33-4c5c-9de4-a3c6cf350c46" style="margin: 0px; padding: 0px; display: inline;"&gt;Technorati
Tags: &lt;a href="http://technorati.com/tags/Syntax%20Highlighter" rel="tag"&gt;Syntax Highlighter&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SyntaxHighlighter" rel="tag"&gt;SyntaxHighlighter&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Google%20Code" rel="tag"&gt;Google
Code&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ActionScript" rel="tag"&gt;ActionScript&lt;/a&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,e54fb1b0-d25c-4f0b-a4cd-eefa8c3715e9.aspx</comments>
      <category>Blogging</category>
      <category>Flash</category>
      <category>JavaScript</category>
      <category>Programming</category>
      <category>Tools</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=31fdba90-a047-4188-9afe-c24d77838bda</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,31fdba90-a047-4188-9afe-c24d77838bda.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,31fdba90-a047-4188-9afe-c24d77838bda.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=31fdba90-a047-4188-9afe-c24d77838bda</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
All right. As mentioned before, here it is: I found a bug in mx.managers.DepthManager
in Flash 8, though I’m sure it affects all ActionScript 2.0 versions of the DepthManager
to date. The bug involves a lack of error handling when DepthManager encounters an
object without a depth, or rather, without a getDepth() method. It shows up through
any use of the DepthManager’s methods, the PopUpManager (mx.managers.PopUpManager),
the Alert class (mx.controls.Alert), etc., when an object on the stage does not have
a getDepth function.
</p>
        <p>
          <strong>What Happens?</strong>
          <br />
The issue manifests itself in many variations, usually by objects placed with the
DepthManager inexplicably replacing previous objects placed with the DepthManager.
Most notably, it manifests itself as modal windows (via PopUpManager) and Alerts not
rendering to the screen, even though the modality seems to have worked and all other
objects on the screen no longer can receive input.
</p>
        <p>
          <strong>Why does this happen?</strong>
          <br />
The DepthManager works off a rather inefficient array to maintain its records. An
object within the DepthManager, the DepthTable, is an indexed array containing record
of every object on the stage and its depth. The DepthManager stores a reference to
the object within the array at the position corresponding to the depth of the object.
If the stage has one object at a depth of 32,000, <code>depthTable[32000] = myObject</code>,
and we have a 32,000-length array with one object stored in it [an inefficiency].
Values in the manager’s depth table are based on available positions in the array,
such as kTopmost being greater than the last movieclip or object in the array [it
iterates one-by-one through each position in our 32000-length array; another inefficiency].
</p>
        <blockquote>
          <p>
            <strong>Excerpt from mx.managers.DepthManager.as</strong>
          </p>
          <pre>
            <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">
              <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">var</span> t:<span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">String</span><span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> typeof(i);<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (t
== “movieclip” || (t == “object” &amp;&amp; i.__getTextFormat !<span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">undefined</span>))<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (i._parent
== <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">this</span>)
{<br />
depthTable[i.getDepth()] <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> i;<br />
}</span>
          </pre>
        </blockquote>
        <p>
However, the DepthManager code is assuming that the object has a getDepth function.
If the object does not have the function, references to that function return undefined,
setting <code>depthTable[undefined] = i</code>, which blows chunks all over the place,
and any reference to any of DepthManager’s depth-returning methods will always return
zero.
</p>
        <p>
That zero is why nothing works anymore; the Alert class creates the new Window-class-like
object, then creates a transparent movieclip below that object to trap all inputs,
creating a sense of modality. The Alert class uses the DepthManager to create itself
at kTopmost, which DepthManager says is zero. The Alert class then uses the DepthManager
to create the modality movieclip above itself, kTopmost, which it then hopes to swapDepth
with to get itself back above the modality clip. However, the Alert class, with itself
at depth zero, creates the modality clip at depth zero because DepthManager said it
was the kTopmost depth. Creating an object at depth zero toasts any object already
at depth zero, thus the modality clip blows away the Alert clip and we get a SWF that
no longer responds to anything, and no Alert ‘OK’ button to restore peace in the world.
Likewise happens when a modal window is created through the PopUpManager.
</p>
        <p>
          <strong>So what can I do about it?</strong>
          <br />
How do you get around this? Simple. Don’t put anything on the stage that extends from
Object. If you put it on the stage, extend it from MovieClip. Even though the DepthManager
code (above) explicitly calls getDepth on MovieClip <em>or</em> Object, it does not
check to see if the object in question actually has a getDepth method. Object does
not have getDepth by default, but MovieClip does. I suppose you could write your own
getDepth function for your Object-inheriting class, or you could rewrite the DepthManager
(which would mean also rewriting PopUpManager, Alert, ComboBox, and a half-dozen other
controls), but it is much simpler to extend from MovieClip.
</p>
        <p>
          <strong>Why it happened to me</strong>
          <br />
I have a movie that is 170KB. There’s a lot of crazy mojo in there, and I want my
prel0ader to load within the first 1KB, not after 170KB. So, I created my preloader,
removed “Export in First Frame” from everything, and set my classes to export in frame
5 (after the end of my preloader loop). However, this made a few of my Object-extending
components no longer work anymore since they were not referenced in the “Assets” layer
of any of the other components (no reference=no load, much like the DataBindingClasses),
to I had to drag them to the stage to ensure that they loaded.
</p>
        <p>
*Poof*
</p>
        <p>
My world exploded.
</p>
        <p>
I lost two days of work tracking this little punk down. And you already know the rest
of the story.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=31fdba90-a047-4188-9afe-c24d77838bda" />
      </body>
      <title>Flash 8 DepthManager Baffled by Those Without Depth</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,31fdba90-a047-4188-9afe-c24d77838bda.aspx</guid>
      <link>http://www.cptloadtest.com/2007/02/09/Flash-8-DepthManager-Baffled-By-Those-Without-Depth.aspx</link>
      <pubDate>Fri, 09 Feb 2007 03:23:12 GMT</pubDate>
      <description>&lt;p&gt;
All right. As mentioned before, here it is: I found a bug in mx.managers.DepthManager
in Flash 8, though I’m sure it affects all ActionScript 2.0 versions of the DepthManager
to date. The bug involves a lack of error handling when DepthManager encounters an
object without a depth, or rather, without a getDepth() method. It shows up through
any use of the DepthManager’s methods, the PopUpManager (mx.managers.PopUpManager),
the Alert class (mx.controls.Alert), etc., when an object on the stage does not have
a getDepth function.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What Happens?&lt;/strong&gt;
&lt;br&gt;
The issue manifests itself in many variations, usually by objects placed with the
DepthManager inexplicably replacing previous objects placed with the DepthManager.
Most notably, it manifests itself as modal windows (via PopUpManager) and Alerts not
rendering to the screen, even though the modality seems to have worked and all other
objects on the screen no longer can receive input.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Why does this happen?&lt;/strong&gt;
&lt;br&gt;
The DepthManager works off a rather inefficient array to maintain its records. An
object within the DepthManager, the DepthTable, is an indexed array containing record
of every object on the stage and its depth. The DepthManager stores a reference to
the object within the array at the position corresponding to the depth of the object.
If the stage has one object at a depth of 32,000, &lt;code&gt;depthTable[32000] = myObject&lt;/code&gt;,
and we have a 32,000-length array with one object stored in it [an inefficiency].
Values in the manager’s depth table are based on available positions in the array,
such as kTopmost being greater than the last movieclip or object in the array [it
iterates one-by-one through each position in our 32000-length array; another inefficiency].
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
&lt;strong&gt;Excerpt from mx.managers.DepthManager.as&lt;/strong&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;var&lt;/span&gt; t:&lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;String&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; typeof(i);&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (t
== “movieclip” || (t == “object” &amp;amp;&amp;amp; i.__getTextFormat !&lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;undefined&lt;/span&gt;))&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (i._parent
== &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt;)
{&lt;br&gt;
depthTable[i.getDepth()] &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; i;&lt;br&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
However, the DepthManager code is assuming that the object has a getDepth function.
If the object does not have the function, references to that function return undefined,
setting &lt;code&gt;depthTable[undefined] = i&lt;/code&gt;, which blows chunks all over the place,
and any reference to any of DepthManager’s depth-returning methods will always return
zero.
&lt;/p&gt;
&lt;p&gt;
That zero is why nothing works anymore; the Alert class creates the new Window-class-like
object, then creates a transparent movieclip below that object to trap all inputs,
creating a sense of modality. The Alert class uses the DepthManager to create itself
at kTopmost, which DepthManager says is zero. The Alert class then uses the DepthManager
to create the modality movieclip above itself, kTopmost, which it then hopes to swapDepth
with to get itself back above the modality clip. However, the Alert class, with itself
at depth zero, creates the modality clip at depth zero because DepthManager said it
was the kTopmost depth. Creating an object at depth zero toasts any object already
at depth zero, thus the modality clip blows away the Alert clip and we get a SWF that
no longer responds to anything, and no Alert ‘OK’ button to restore peace in the world.
Likewise happens when a modal window is created through the PopUpManager.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;So what can I do about it?&lt;/strong&gt;
&lt;br&gt;
How do you get around this? Simple. Don’t put anything on the stage that extends from
Object. If you put it on the stage, extend it from MovieClip. Even though the DepthManager
code (above) explicitly calls getDepth on MovieClip &lt;em&gt;or&lt;/em&gt; Object, it does not
check to see if the object in question actually has a getDepth method. Object does
not have getDepth by default, but MovieClip does. I suppose you could write your own
getDepth function for your Object-inheriting class, or you could rewrite the DepthManager
(which would mean also rewriting PopUpManager, Alert, ComboBox, and a half-dozen other
controls), but it is much simpler to extend from MovieClip.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Why it happened to me&lt;/strong&gt;
&lt;br&gt;
I have a movie that is 170KB. There’s a lot of crazy mojo in there, and I want my
prel0ader to load within the first 1KB, not after 170KB. So, I created my preloader,
removed “Export in First Frame” from everything, and set my classes to export in frame
5 (after the end of my preloader loop). However, this made a few of my Object-extending
components no longer work anymore since they were not referenced in the “Assets” layer
of any of the other components (no reference=no load, much like the DataBindingClasses),
to I had to drag them to the stage to ensure that they loaded.
&lt;/p&gt;
&lt;p&gt;
*Poof*
&lt;/p&gt;
&lt;p&gt;
My world exploded.
&lt;/p&gt;
&lt;p&gt;
I lost two days of work tracking this little punk down. And you already know the rest
of the story.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=31fdba90-a047-4188-9afe-c24d77838bda" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,31fdba90-a047-4188-9afe-c24d77838bda.aspx</comments>
      <category>Flash</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=7516ae50-5fc9-4f7f-95b3-68deb6d14bac</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,7516ae50-5fc9-4f7f-95b3-68deb6d14bac.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,7516ae50-5fc9-4f7f-95b3-68deb6d14bac.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7516ae50-5fc9-4f7f-95b3-68deb6d14bac</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been working on creating a Flash component for within our LMS that allows a student
to view their completion statuses in a curriculum, as well as allows managers to view
the curriculum status of all of their students. The component relies on Web Services
to volley data with the server. I was having some trouble binding data from my WebServiceConnector
to my DataSets because, as it turned out, Flash was holding on to a cached version
of the WSDL–a cached version that was ultimately obsolete.
</p>
        <p>
I was on the hunt to find the source, and kill the evil cache file. After clearing
out every Temp folder I could think of, I started playing around in my Local Settings
folder and it turns out that Flash will forever-store cached copies of your WSDL deep
within your ‘Documents and settings’.
</p>
        <p>
C:\Documents and Settings\[user name]\Local Settings\Application Data\Macromedia\[your
flash version]\en\Configuration\WebServices\
</p>
        <p>
I just booted every file in the WebServices directory, but I am assuming that you
could get away with just deleting ‘WSDLCacheMap.xml’, or if you want to keep the remainder
of your cache, just delete the appropriate WSDL cache file (ex: WSDLkgzmcu.wsdl).
In any event, once you have exercised your delete button, simply restart Flash and
reload the WSC instance, and you will be good to go.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=7516ae50-5fc9-4f7f-95b3-68deb6d14bac" />
      </body>
      <title>Clearing Flash IDE WSDL Cache</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,7516ae50-5fc9-4f7f-95b3-68deb6d14bac.aspx</guid>
      <link>http://www.cptloadtest.com/2006/10/17/Clearing-Flash-IDE-WSDL-Cache.aspx</link>
      <pubDate>Tue, 17 Oct 2006 02:48:43 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been working on creating a Flash component for within our LMS that allows a student
to view their completion statuses in a curriculum, as well as allows managers to view
the curriculum status of all of their students. The component relies on Web Services
to volley data with the server. I was having some trouble binding data from my WebServiceConnector
to my DataSets because, as it turned out, Flash was holding on to a cached version
of the WSDL–a cached version that was ultimately obsolete.
&lt;/p&gt;
&lt;p&gt;
I was on the hunt to find the source, and kill the evil cache file. After clearing
out every Temp folder I could think of, I started playing around in my Local Settings
folder and it turns out that Flash will forever-store cached copies of your WSDL deep
within your ‘Documents and settings’.
&lt;/p&gt;
&lt;p&gt;
C:\Documents and Settings\[user name]\Local Settings\Application Data\Macromedia\[your
flash version]\en\Configuration\WebServices\
&lt;/p&gt;
&lt;p&gt;
I just booted every file in the WebServices directory, but I am assuming that you
could get away with just deleting ‘WSDLCacheMap.xml’, or if you want to keep the remainder
of your cache, just delete the appropriate WSDL cache file (ex: WSDLkgzmcu.wsdl).
In any event, once you have exercised your delete button, simply restart Flash and
reload the WSC instance, and you will be good to go.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=7516ae50-5fc9-4f7f-95b3-68deb6d14bac" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,7516ae50-5fc9-4f7f-95b3-68deb6d14bac.aspx</comments>
      <category>Flash</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=ebac1357-4981-4c50-ac96-927ce36051b3</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,ebac1357-4981-4c50-ac96-927ce36051b3.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,ebac1357-4981-4c50-ac96-927ce36051b3.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ebac1357-4981-4c50-ac96-927ce36051b3</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This just toasted two hours of my morning, and ended with a “Huh. I never would have
thought of that!” moment. And whenever I have one of those, I like to toss the problem
and the solution up here in the hopes of saving two hours from someone else’s morning,
someday.
</p>
        <p>
          <strong>Problem</strong>
          <br />
We have a Scorm course. The course is coded in Flash and heavily relies on FLVs. For
one of our client’s sites, we just rebuilt the Staging environment, upgrading to Windows
2003. Ever since the rebuild, this course in question hasn’t worked in the Staging
environment. It works fine in Production, but not in Staging. It’s the same code,
but it works in once place and not in the other. I hate it when that happens.
</p>
        <p>
Turns out that we didn’t have and needed a MIME for FLVs.
</p>
        <p>
          <strong>Solution</strong>
          <br />
Crack open INetMgr. (These directions are for IIS6)
</p>
        <ol>
          <li>
Right-click the server, and hit ‘Properties’</li>
          <li>
In the Properties window, click the “MIME Types…” button</li>
          <li>
In the MIME Types window, click “New…”</li>
          <li>
Extension: .flv</li>
          <li>
MIME Type: video/x-flv</li>
          <li>
OK, OK, OK, you’re done</li>
        </ol>
        <p>
Thanks to Don DiCicco for finding the solution to this one. He googled up a <a href="http://jeroenwijering.com/?thread=FLV_Web_Help">link</a> to
a similar post on this same problem / solution. And thanks to good ol’ JT for posting
the original solution, whoever you are.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=ebac1357-4981-4c50-ac96-927ce36051b3" />
      </body>
      <title>Help! My FLVs won't play!</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,ebac1357-4981-4c50-ac96-927ce36051b3.aspx</guid>
      <link>http://www.cptloadtest.com/2006/08/17/Help-My-FLVs-Wont-Play.aspx</link>
      <pubDate>Thu, 17 Aug 2006 12:09:57 GMT</pubDate>
      <description>&lt;p&gt;
This just toasted two hours of my morning, and ended with a “Huh. I never would have
thought of that!” moment. And whenever I have one of those, I like to toss the problem
and the solution up here in the hopes of saving two hours from someone else’s morning,
someday.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Problem&lt;/strong&gt;
&lt;br&gt;
We have a Scorm course. The course is coded in Flash and heavily relies on FLVs. For
one of our client’s sites, we just rebuilt the Staging environment, upgrading to Windows
2003. Ever since the rebuild, this course in question hasn’t worked in the Staging
environment. It works fine in Production, but not in Staging. It’s the same code,
but it works in once place and not in the other. I hate it when that happens.
&lt;/p&gt;
&lt;p&gt;
Turns out that we didn’t have and needed a MIME for FLVs.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Solution&lt;/strong&gt;
&lt;br&gt;
Crack open INetMgr. (These directions are for IIS6)
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Right-click the server, and hit ‘Properties’&lt;/li&gt;
&lt;li&gt;
In the Properties window, click the “MIME Types…” button&lt;/li&gt;
&lt;li&gt;
In the MIME Types window, click “New…”&lt;/li&gt;
&lt;li&gt;
Extension: .flv&lt;/li&gt;
&lt;li&gt;
MIME Type: video/x-flv&lt;/li&gt;
&lt;li&gt;
OK, OK, OK, you’re done&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Thanks to Don DiCicco for finding the solution to this one. He googled up a &lt;a href="http://jeroenwijering.com/?thread=FLV_Web_Help"&gt;link&lt;/a&gt; to
a similar post on this same problem / solution. And thanks to good ol’ JT for posting
the original solution, whoever you are.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=ebac1357-4981-4c50-ac96-927ce36051b3" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,ebac1357-4981-4c50-ac96-927ce36051b3.aspx</comments>
      <category>Flash</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=028d46b4-226b-443b-9a01-d943bb4d6e09</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,028d46b4-226b-443b-9a01-d943bb4d6e09.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,028d46b4-226b-443b-9a01-d943bb4d6e09.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=028d46b4-226b-443b-9a01-d943bb4d6e09</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
“He’s a big pig. You can be a big pig, too.” ~Timon
</p>
        <p>
Turns out that Flash isn’t the murderous killer with the 9-inch chef’s knife. It’s
just a big pig. Flash, within this Scorm course, was passing Scorm data to an external
JavaScript function. JS was opening an ActiveX XmlHttpRequest object to send the Scorm
data to the service via a WebService call (think AJAX). However, Flash was requiring
that this be a <em>synchronous</em> call (so much for AJAX). W3C regulates [<em>Hypertext
Transfer Protocol — HTTP/1.1</em><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4">RFC
2616 Section 8.1.4</a>] that “a single-user client should not maintain more than 2
connections with any server or proxy.” Flash is busy downloading external assets,
so both connections were taken, and it then says “go and make a synchronous XML call.”
XmlHttpRequest object doesn’t like making a synchronous call when there are no available
connections to the server; it bugs out and the browser freezes.
</p>
        <p>
Hopefully things will be better with Internet Explorer 7. It is slated to no longer
use the ActiveX version of XmlHttpRequest object, but rather the XmlRequest object
that Mozilla uses. Perhaps this one will handle itself a little better.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=028d46b4-226b-443b-9a01-d943bb4d6e09" />
      </body>
      <title>Update: External Flash assets freezing the browser</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,028d46b4-226b-443b-9a01-d943bb4d6e09.aspx</guid>
      <link>http://www.cptloadtest.com/2006/03/23/Update-External-Flash-Assets-Freezing-The-Browser.aspx</link>
      <pubDate>Thu, 23 Mar 2006 14:41:30 GMT</pubDate>
      <description>&lt;p&gt;
“He’s a big pig. You can be a big pig, too.” ~Timon
&lt;/p&gt;
&lt;p&gt;
Turns out that Flash isn’t the murderous killer with the 9-inch chef’s knife. It’s
just a big pig. Flash, within this Scorm course, was passing Scorm data to an external
JavaScript function. JS was opening an ActiveX XmlHttpRequest object to send the Scorm
data to the service via a WebService call (think AJAX). However, Flash was requiring
that this be a &lt;em&gt;synchronous&lt;/em&gt; call (so much for AJAX). W3C regulates [&lt;em&gt;Hypertext
Transfer Protocol — HTTP/1.1&lt;/em&gt; &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4"&gt;RFC
2616 Section 8.1.4&lt;/a&gt;] that “a single-user client should not maintain more than 2
connections with any server or proxy.” Flash is busy downloading external assets,
so both connections were taken, and it then says “go and make a synchronous XML call.”
XmlHttpRequest object doesn’t like making a synchronous call when there are no available
connections to the server; it bugs out and the browser freezes.
&lt;/p&gt;
&lt;p&gt;
Hopefully things will be better with Internet Explorer 7. It is slated to no longer
use the ActiveX version of XmlHttpRequest object, but rather the XmlRequest object
that Mozilla uses. Perhaps this one will handle itself a little better.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=028d46b4-226b-443b-9a01-d943bb4d6e09" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,028d46b4-226b-443b-9a01-d943bb4d6e09.aspx</comments>
      <category>Flash</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=863ad05c-d529-40ff-bff4-e3db018846af</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,863ad05c-d529-40ff-bff4-e3db018846af.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,863ad05c-d529-40ff-bff4-e3db018846af.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=863ad05c-d529-40ff-bff4-e3db018846af</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Flash movies with multiple external assets can cause the browser to lock up if external
Flash assets (videos, images, voice-overs, etc, that are not stored within the SWF)
are unmanaged or managed improperly. I’ll use a Scorm-compliant course as an example;
the example course navigates from screen using inline Back and Next buttons, and each
screen loads unique external animation and voice-over to deliver the lesson topic.
</p>
        <ul>
          <strong>The browser freezes when:</strong>
          <p>
          </p>
          <li>
The user skips lesson information by clicking “Next” in rapid succession (assets are
not downloaded to local cache before progressing to next screen)</li>
          <li>
The user re-enters a course for which they have a previously saved Scorm-bookmark,
and quickly navigate to where they left off, either by menu navigation or by rapidly
clicking “Next” (assets are not downloaded to local cache before progressing to next
screen)</li>
          <li>
The user rapidly clicks “Back” through screens that they did not experience in their
entirety (assets were not fully downloaded and stored in local cache)</li>
          <li>
The user navigates to other areas of the course through menu navigation before they
have experienced the current screen in its entirety (assets are not downloaded to
local cache before proceeding) 
<ul><strong>The recurrence is exacerbated by:</strong><p></p><li>
Slower connection speeds (it takes longer to download a single asset)</li><li>
Larger file sizes on external Flash assets (it takes longer to download a single asset)</li><li>
Having multiple external Flash assets on a single screen (it takes longer to download
a single asset)</li></ul></li>
        </ul>
        <ul>
          <strong>The course does not freeze when:</strong>
          <p>
          </p>
          <li>
The user linearly navigates through the course, experiencing each screen in its entirety
before progressing to the next screen or area. (assets are allowed to fully download
and store in local cache before proceeding to next screen)</li>
          <li>
The user skips lesson information by clicking “Next” in rapid succession through courses
that they have previously visited in this session and experienced in their entirety
(assets are already in local cache)</li>
          <li>
The user rapidly clicks “Back” through screens that they did experience in their entirety
in this session (assets are already in local cache)</li>
          <li>
The user navigates to other areas of the course through menu navigation after they
have experienced the current screen in its entirety (assets are allowed to fully download
and store in local cache before proceeding to next screen)</li>
        </ul>
        <p>
When a user navigates from Screen #1 to Screen #2, any outstanding, incomplete asset
downloads from Screen #1 should be stopped before beginning Screen #2 asset downloads.
Failure to do so may cause the browser’s request queue to overflow, and freeze the
browser window.
</p>
        <p>
Such is the case when assets are not properly managed: when a user navigates from
Screen #1 to Screen #2, the Screen #1 assets continue to download with the #2 assets.
Likewise, when the user navigates from Screen #2 to Screen #3, assets from Screens
#1, #2, and #3 are all downloading. When Flash is downloading enough concurrent assets,
a request queue overflows, freezing the browser.
</p>
        <p>
          <strong>IMPORTANT:</strong> Users clicking Next rapidly is not the only cause of this
issue. Rapid Next is just the easiest way to recreate it. The important point is that
users are clicking next faster than Flash can download the other assets. In other
words, navigation is adding assets to the download queue faster than Flash can download
them, and the queue is filling up.
</p>
        <ol>
        </ol>
        <strong>A sample browser-freezing scenario:</strong>
        <br />
        <em>(Ex: Unmanaged external assets. User rapidly clicks next.)</em>
        <p>
        </p>
        <li>
User launches course. Flash switches to Screen #1 and begins downloading Screen #1
voice-over and Screen #1 animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download.<br /><em>(2 assets downloading)</em></li>
        <li>
User quickly hits Next. Flash switches to Screen #2. Does not sever Screen #1 asset
connections. Begins downloading Screen #2 VO and Animation. If applicable: HTML, Non-flash
images, stylesheets, etc all download, but do so slower.<br /><em>(4 assets downloading)</em></li>
        <li>
User quickly hits Next. Flash switches to Screen #3. Does not sever Screen #2 asset
connections. Begins downloading Screen #3 VO and Animation. If applicable: HTML, Non-flash
images, stylesheets, etc all download, but do so slower.<br /><em>(6 assets downloading)</em></li>
        <li>
…</li>
        <li>
User repeatedly hits Next. Flash navigates through appropriate screens, downloading
new assets but never severing previous asset connections.<br /><em>(Many assets downloading)</em></li>
        <ul style="margin: 0px 0px 0px 20px; list-style-type: square;">
          <li>
Browser request queue overflow.</li>
          <li>
If applicable: HTML, non-flash images, stylesheets, etc, DO NOT download.</li>
          <li>
Browser freezes.</li>
        </ul>
        <ol>
        </ol>
        <strong>Under a non-freezing scenario:</strong>
        <br />
        <em>(Ex: Managed external assets and/or User proceeds slowly through course)</em>
        <p>
        </p>
        <li>
User launches course. Flash switches to Screen #1 and begins downloading Screen #1
voice-over and Screen #1 animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download with no degradation.<br /><em>(2 assets downloading)</em></li>
        <li>
User hits Next. Flash switches to Screen #2. Severs Screen #1 asset connections. Begins
downloading Screen #2 VO and Animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download with no degradation.<br />
(2 assets downloading)</li>
        <li>
User hits Next. Flash switches to Screen #3. Severs Screen #2 asset connections. Begins
downloading Screen #3 VO and Animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download with no degradation.<br />
(2 assets downloading)</li>
        <li>
…</li>
        <li>
User hits Next. Flash navigates through appropriate screens, downloading new assets.
Previous asset connections are severed.<br />
(2 assets downloading)</li>
        <ul style="margin: 0px 0px 0px 20px; list-style-type: square;">
          <li>
No Browser request queue overflow occurs</li>
        </ul>
        <blockquote>
          <p>
            <strong>Example Code that causes the problem:</strong>
            <br />
narrator = createClassObject(MediaDisplay, “My_VoiceOver”);<br />
narrator.setMedia(”/Assets/MyVoiceOver.mp3″, “MP3″);
</p>
          <p>
// … code omitted …<br />
// … do some stuff …<br />
// … do some stuff …<br />
// … code omitted …
</p>
          <p>
// commented out code<br />
// destroyObject(”My_VoiceOver”);
</p>
        </blockquote>
        <p>
The code above creates a new object that loads and plays an MP3. However, (because
the line of code is commented out) the object is never destroyed and continues to
download. If this function is called repeatedly, each time against a different voice-over
file, the queue will overflow and the browser will freeze. The same will occur wherever
destroyObject (or similar command) is not called.<br />
To fix the code in the above scenario, destroyObject must be uncommented, allowing
the object to be destroyed, thus stopping the MP3 download.
</p>
        <p>
          <strong>Note:</strong> This is not the only code scenario that would create this browser-freezing
problem. There are many possible commands and variations.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=863ad05c-d529-40ff-bff4-e3db018846af" />
      </body>
      <title>External Flash assets freezing the browser</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,863ad05c-d529-40ff-bff4-e3db018846af.aspx</guid>
      <link>http://www.cptloadtest.com/2006/03/20/External-Flash-Assets-Freezing-The-Browser.aspx</link>
      <pubDate>Mon, 20 Mar 2006 14:36:45 GMT</pubDate>
      <description>&lt;p&gt;
Flash movies with multiple external assets can cause the browser to lock up if external
Flash assets (videos, images, voice-overs, etc, that are not stored within the SWF)
are unmanaged or managed improperly. I’ll use a Scorm-compliant course as an example;
the example course navigates from screen using inline Back and Next buttons, and each
screen loads unique external animation and voice-over to deliver the lesson topic.
&lt;/p&gt;
&lt;ul&gt;
&lt;strong&gt;The browser freezes when:&lt;/strong&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;li&gt;
The user skips lesson information by clicking “Next” in rapid succession (assets are
not downloaded to local cache before progressing to next screen)&lt;/li&gt;
&lt;li&gt;
The user re-enters a course for which they have a previously saved Scorm-bookmark,
and quickly navigate to where they left off, either by menu navigation or by rapidly
clicking “Next” (assets are not downloaded to local cache before progressing to next
screen)&lt;/li&gt;
&lt;li&gt;
The user rapidly clicks “Back” through screens that they did not experience in their
entirety (assets were not fully downloaded and stored in local cache)&lt;/li&gt;
&lt;li&gt;
The user navigates to other areas of the course through menu navigation before they
have experienced the current screen in its entirety (assets are not downloaded to
local cache before proceeding) 
&lt;ul&gt;
&lt;strong&gt;The recurrence is exacerbated by:&lt;/strong&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;li&gt;
Slower connection speeds (it takes longer to download a single asset)&lt;/li&gt;
&lt;li&gt;
Larger file sizes on external Flash assets (it takes longer to download a single asset)&lt;/li&gt;
&lt;li&gt;
Having multiple external Flash assets on a single screen (it takes longer to download
a single asset)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;strong&gt;The course does not freeze when:&lt;/strong&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;li&gt;
The user linearly navigates through the course, experiencing each screen in its entirety
before progressing to the next screen or area. (assets are allowed to fully download
and store in local cache before proceeding to next screen)&lt;/li&gt;
&lt;li&gt;
The user skips lesson information by clicking “Next” in rapid succession through courses
that they have previously visited in this session and experienced in their entirety
(assets are already in local cache)&lt;/li&gt;
&lt;li&gt;
The user rapidly clicks “Back” through screens that they did experience in their entirety
in this session (assets are already in local cache)&lt;/li&gt;
&lt;li&gt;
The user navigates to other areas of the course through menu navigation after they
have experienced the current screen in its entirety (assets are allowed to fully download
and store in local cache before proceeding to next screen)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
When a user navigates from Screen #1 to Screen #2, any outstanding, incomplete asset
downloads from Screen #1 should be stopped before beginning Screen #2 asset downloads.
Failure to do so may cause the browser’s request queue to overflow, and freeze the
browser window.
&lt;/p&gt;
&lt;p&gt;
Such is the case when assets are not properly managed: when a user navigates from
Screen #1 to Screen #2, the Screen #1 assets continue to download with the #2 assets.
Likewise, when the user navigates from Screen #2 to Screen #3, assets from Screens
#1, #2, and #3 are all downloading. When Flash is downloading enough concurrent assets,
a request queue overflows, freezing the browser.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;IMPORTANT:&lt;/strong&gt; Users clicking Next rapidly is not the only cause of this
issue. Rapid Next is just the easiest way to recreate it. The important point is that
users are clicking next faster than Flash can download the other assets. In other
words, navigation is adding assets to the download queue faster than Flash can download
them, and the queue is filling up.
&lt;/p&gt;
&lt;ol&gt;
&lt;strong&gt;A sample browser-freezing scenario:&lt;/strong&gt;
&lt;br&gt;
&lt;em&gt;(Ex: Unmanaged external assets. User rapidly clicks next.)&lt;/em&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;li&gt;
User launches course. Flash switches to Screen #1 and begins downloading Screen #1
voice-over and Screen #1 animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download.&lt;br&gt;
&lt;em&gt;(2 assets downloading)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
User quickly hits Next. Flash switches to Screen #2. Does not sever Screen #1 asset
connections. Begins downloading Screen #2 VO and Animation. If applicable: HTML, Non-flash
images, stylesheets, etc all download, but do so slower.&lt;br&gt;
&lt;em&gt;(4 assets downloading)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
User quickly hits Next. Flash switches to Screen #3. Does not sever Screen #2 asset
connections. Begins downloading Screen #3 VO and Animation. If applicable: HTML, Non-flash
images, stylesheets, etc all download, but do so slower.&lt;br&gt;
&lt;em&gt;(6 assets downloading)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
…&lt;/li&gt;
&lt;li&gt;
User repeatedly hits Next. Flash navigates through appropriate screens, downloading
new assets but never severing previous asset connections.&lt;br&gt;
&lt;em&gt;(Many assets downloading)&lt;/em&gt;
&lt;/li&gt;
&lt;ul style="margin: 0px 0px 0px 20px; list-style-type: square;"&gt;
&lt;li&gt;
Browser request queue overflow.&lt;/li&gt;
&lt;li&gt;
If applicable: HTML, non-flash images, stylesheets, etc, DO NOT download.&lt;/li&gt;
&lt;li&gt;
Browser freezes.&lt;/li&gt;
&lt;/ul&gt;
&gt;
&lt;ol&gt;
&lt;strong&gt;Under a non-freezing scenario:&lt;/strong&gt;
&lt;br&gt;
&lt;em&gt;(Ex: Managed external assets and/or User proceeds slowly through course)&lt;/em&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;li&gt;
User launches course. Flash switches to Screen #1 and begins downloading Screen #1
voice-over and Screen #1 animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download with no degradation.&lt;br&gt;
&lt;em&gt;(2 assets downloading)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
User hits Next. Flash switches to Screen #2. Severs Screen #1 asset connections. Begins
downloading Screen #2 VO and Animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download with no degradation.&lt;br&gt;
(2 assets downloading)&lt;/li&gt;
&lt;li&gt;
User hits Next. Flash switches to Screen #3. Severs Screen #2 asset connections. Begins
downloading Screen #3 VO and Animation. If applicable: HTML, Non-flash images, stylesheets,
etc all download with no degradation.&lt;br&gt;
(2 assets downloading)&lt;/li&gt;
&lt;li&gt;
…&lt;/li&gt;
&lt;li&gt;
User hits Next. Flash navigates through appropriate screens, downloading new assets.
Previous asset connections are severed.&lt;br&gt;
(2 assets downloading)&lt;/li&gt;
&lt;ul style="margin: 0px 0px 0px 20px; list-style-type: square;"&gt;
&lt;li&gt;
No Browser request queue overflow occurs&lt;/li&gt;
&lt;/ul&gt;
&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Example Code that causes the problem:&lt;/strong&gt;
&lt;br&gt;
narrator = createClassObject(MediaDisplay, “My_VoiceOver”);&lt;br&gt;
narrator.setMedia(”/Assets/MyVoiceOver.mp3″, “MP3″);
&lt;/p&gt;
&lt;p&gt;
// … code omitted …&lt;br&gt;
// … do some stuff …&lt;br&gt;
// … do some stuff …&lt;br&gt;
// … code omitted …
&lt;/p&gt;
&lt;p&gt;
// commented out code&lt;br&gt;
// destroyObject(”My_VoiceOver”);
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The code above creates a new object that loads and plays an MP3. However, (because
the line of code is commented out) the object is never destroyed and continues to
download. If this function is called repeatedly, each time against a different voice-over
file, the queue will overflow and the browser will freeze. The same will occur wherever
destroyObject (or similar command) is not called.&lt;br&gt;
To fix the code in the above scenario, destroyObject must be uncommented, allowing
the object to be destroyed, thus stopping the MP3 download.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Note:&lt;/strong&gt; This is not the only code scenario that would create this browser-freezing
problem. There are many possible commands and variations.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=863ad05c-d529-40ff-bff4-e3db018846af" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,863ad05c-d529-40ff-bff4-e3db018846af.aspx</comments>
      <category>Flash</category>
    </item>
  </channel>
</rss>