<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>munky.net &#187; Flash ActionScript</title>
	<atom:link href="http://www.munky.net/category/software/flash-actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.munky.net</link>
	<description>design and open source</description>
	<lastBuildDate>Fri, 19 Aug 2011 18:27:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using a preloader with v2 components</title>
		<link>http://www.munky.net/software/flash-actionscript/using-a-preloader-with-v2-components/</link>
		<comments>http://www.munky.net/software/flash-actionscript/using-a-preloader-with-v2-components/#comments</comments>
		<pubDate>Fri, 20 Aug 2004 06:34:22 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=16</guid>
		<description><![CDATA[I've finally nailed down a good way to use a preloader with Flash Player 7 movies that use the v2 component framework. <a href="http://www.munky.net/software/flash-actionscript/using-a-preloader-with-v2-components/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever since Flash MX 2004 Pro was released, I&#8217;ve been struggling with the question of how to create a lightweight preloader for movies that use v2 components. The basic problem is that the v2 components come with a large ActionScript class library that can add a substantial amount to even small movies that use even one component.</p>
<p>For awhile I&#8217;d been using an approach that involved a small preloader movie that displayed a loading animation and progress bar, and used loadMovie() to load the content movie (with components) into an empty clip. This worked in many cases, but it turns out that there are some v2 components, such as ComboBox and Window, that don&#8217;t work properly when they&#8217;re loaded into a sub-clip in this manner. Basically, those components contain code that makes explicit references to the _root timeline, which is a no-no. The Macromedia docs suggest using the _lockroot property on the target clip in order to trick the components into seeing the proper timeline as _root, but in my experiments I have found that this does not always work.</p>
<p>Recently, thanks to an entry in Jesse Warden&#8217;s blog, have been able to create a preloader that works with movies that use v2 components. As an added bonus, the preloader does not need to reside in a separate swf file, and thus doesn&#8217;t need to mess with _lockroot &#8212; it can be implemented as part of the main movie. I&#8217;ll describe the steps needed to accomplish this below, if for no other purpose than to remind myself of what I did!</p>
<p>Start with a movie that uses v2 components. Open up the library and identify these two types of symbols:</p>
<ol>
<li>all component symbols (Button, ComboBox, Label, Window, etc.)</li>
<li>all compiled clips and/or movie clips that will be dynamically instantiated at runtime; this includes View symbols for window and accordion contents, component skin symbols, etc.</li>
</ol>
<p>I usually keep these types of symbols in a separate folder in the library. For each of these symbols, right click and open the &#8220;Linkage&#8230;&#8221; dialog, and deselect &#8220;Export in first frame&#8221;. This prevents the code and assets for those symbols from being loaded at the very beginning of the movie, which means we&#8217;ll be able to put up a preloader before those start loading. It&#8217;s very imporant to indentify all components and dynamically instantiated symbols used in the movie and edit their library symbol entries in this way.</p>
<p>One important exception to this is the DataBindingClasses symbol that gets added to the library automatically whenever you use a v2 component in a movie. This symbol needs to have &#8220;Export in first frame&#8221; checked. I think the reason for this is that it needs to load before any components do. At any rate, even though we&#8217;re leaving it as one of the things that gets loaded at the very beginning of the movie, it&#8217;s not very large so it shouldn&#8217;t affect the preloader loading time too much.</p>
<p>The next step is to add three blank keyframes to the very beginning of the main timeline. There should initially be nothing at all on the stage on these frames; in other words, all your main movie content needs to be shifted three frames to the right. At this point I also usually add a new movie layer called &#8220;preloader&#8221;, and I&#8217;m also assuming that you already have a &#8220;script&#8221; or &#8220;code&#8221; layer that contains only frame actions.</p>
<p>The first two of the three new frames will be used for the preloader loop. Frame 1 actions should look like this:</p>
<p><code>// Frame 1 actions<br />
trace(getBytesLoaded()+" of "+getBytesTotal());<br />
if (getBytesLoaded() > 0 &#038;&#038; getBytesLoaded() >= getBytesTotal()) gotoAndPlay(3);</code></p>
<p>Of course the trace is optional, and could be replaced with a line that sets the percentage loaded value on a progress bar or other indicator. Next, set this line as the frame 2 action:</p>
<p><code>// Frame 2 actions<br />
gotoAndPlay(1);</code></p>
<p>These two frame actions are just the typical way to &#8220;pause&#8221; a movie until the whole swf file has loaded on the client machine. Once the entire movie has loaded, the playhead is allowed to proceed to frame 3. Your lightweight preloader animation and/or loading indicator can be put on the stage on the &#8220;preloader&#8221; layer spanning frames 1 and 2, so that they are visible during the preloading process.</p>
<p>The next step is to create a special frame on frame 3, which contains instances of all the symbols for which we unchecked &#8220;Export in first frame&#8221; in the first step (this is why we organized them into a special library folder earlier). Create a blank keyframe at frame 3 on the preloader layer and drag one instance of each such component onto the stage but outside the movie&#8217;s viewable area. What we&#8217;re doing here is telling the Flash compiler that it will indeed need to load these assets for use on frame 3 and beyond (since it&#8217;s not going to load them at the beginning of the movie as usual). These component instances don&#8217;t have to stay on the stage past frame 3; a brief appearance on this single frame is enough to tell the compiler when they need to be loaded.</p>
<p>The observant reader will note that it&#8217;s not actually necessary for each and every one of these clips to be instantiated on frame 3, since many of them probably appear on the timeline later on past frame 3 anyway. Technically this is true &#8212; all we really need is for each symbol that gets dynamically instantiated by application ActionScript code, and therefore isn&#8217;t statically placed on the timeline in the authoring environment &#8212; to be instantiated in this way on frame 3. This includes some components, namely Window, which tends to be instantiated at runtime using the PopupManager class. However, it doesn&#8217;t hurt just to instantiate everything on frame 3, so I&#8217;m recommending that as a less error-prone approach.</p>
<p>The final &#8212; and quite critical &#8212; step is to tell the compiler that ActionScript classes should be loaded on frame 3 instead of frame 1. This can be done by going to the dialog at File Publish Settings&#8230; Flash (ActionScript) Settings&#8230; and setting the &#8220;Export Frame for Classes&#8221; value to 3. This prevents the huge chunk of ActionScript class code that comes along with the v2 components from being loaded at the beginning of the movie and thus trumping the preloader. The important thing is that the class export frame be no later than the frame on which the symbols that use those classes first appear.</p>
<p>At this point your timeline should look something like this:</p>
<p><img alt="Timeline" src="http://www.munky.net/blog_img/preloader_timeline.png" /></p>
<p>In the above image, the frame colors correspond to:</p>
<ul>
<li>orange: the two script frames with the preloader loop actions described above</li>
<li>green: any lightweight preloader animation and/or loading indicator clips</li>
<li>yellow: the special frame on which any dynamically instantiated symbols are manually instantiated on the stage but outside the viewable area</li>
<li>blue: the main movie that is being preloaded</li>
</ul>
<p>You should be able to verify that the loading sequence is working as intended by selecting &#8220;generate size report&#8221; on the Flash Publish Settings dialog, and examining the report to ensure that the bulk of the movie doesn&#8217;t get loaded until frame 3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/using-a-preloader-with-v2-components/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using a static initializer in AS2.0</title>
		<link>http://www.munky.net/software/flash-actionscript/using-a-static-initializer-in-as20/</link>
		<comments>http://www.munky.net/software/flash-actionscript/using-a-static-initializer-in-as20/#comments</comments>
		<pubDate>Thu, 19 Aug 2004 06:30:26 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=15</guid>
		<description><![CDATA[Some design patterns require the use of a static initializer, a block of code that should execute once and only once the first time a class is referred to. The typical use for this pattern in ActionScript programming is when &#8230; <a href="http://www.munky.net/software/flash-actionscript/using-a-static-initializer-in-as20/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some design patterns require the use of a static initializer, a block of code that should execute once and only once the first time a class is referred to. The typical use for this pattern in ActionScript programming is when a mix-in class needs to be used, as in the case of the mx.events.EventDispatcher class. EventDispatcher contains a static method, EventDispatcher.initialize(), which can be invoked to add the event framework methods to any arbitrary class.</p>
<p>Say we have a class called ActionManager that needs the event handling mix-in methods. One approach would be to invoke EventDispatcher.initialize(this) in ActionManager&#8217;s constructor method; however, this approach suffers from the drawback that the EventDispatcher initializer could be invoked multiple times (each time a new ActionManger instance is created), when it really only should be invoked once.</p>
<p>If we were programming in Java, we&#8217;d be able to do something like this, using the static initializer syntax:</p>
<pre>public class ActionManager {
static {
mx.events.EventDispatcher.initialize(ActionManager.class);
}
public ActionManager() {
...
}
...
}</pre>
<p>Now, ActionScript doesn&#8217;t have this sort of static block syntax, but fortunately there is a way to accomplish the same thing:</p>
<pre>class ActionManager {
private var staticInitialized:Boolean = staticInitializer();
private static function staticInitializer(Void):Boolean {
mx.events.EventDispatcher.initialize(ActionManager.prototype);
return true;
}
public function ActionManager(Void) {
...
}
}</pre>
<p>The ActionScript pattern illustrated above does the same thing as Java&#8217;s static initializer block syntax &#8212; the staticInitializer() method will only be called once, the first time the class is referenced, and before the constructor method is invoked.</p>
<p>Although this pattern is typically used to set up mix-in classes such as EventDispatcher, it is also useful for setting up arbitrary static class memebers such as lookup tables, etc., which only need to be calculated once across all instances of a class.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/using-a-static-initializer-in-as20/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Differences between AS2.0 and Java</title>
		<link>http://www.munky.net/software/flash-actionscript/differences-between-as20-and-java/</link>
		<comments>http://www.munky.net/software/flash-actionscript/differences-between-as20-and-java/#comments</comments>
		<pubDate>Tue, 24 Feb 2004 04:01:55 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=2</guid>
		<description><![CDATA[ActionScript 2.0 is much more object oriented and Java-like than its predecessor, which makes it easy to learn for Java programmers. Here are some key differences, which may help make the transition easier. <a href="http://www.munky.net/software/flash-actionscript/differences-between-as20-and-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ActionScript 2.0 is much more object oriented and Java-like than its predecessor, which makes it easy to learn for Java programmers. Here are some key differences, which may help make the transition easier:</p>
<p><strong>Static Classes</strong></p>
<p>Although AS2.0 does support static classes, a crucial difference from Java is that static members cannot be accessed through instance variables. For example, if we have a Java class Foo that defines a public static field BAR, the following would output the value of BAR:</p>
<p><code>Foo myFoo = new Foo();<br />
System.out.println("BAR is "+myFoo.BAR);<br />
</code></p>
<p>However, this will not work in AS2.0 since static members can&#8217;t be accessed through instance variables. Instead, we&#8217;d only be able to access BAR through the static reference Foo.BAR. In my opinion, this is a significant shortcoming that breaks some important design patterns that rely on static members.</p>
<p><strong>No Multithreading</strong></p>
<p>ActionScript is not multithreaded. This relieves us from having to worry about thread management with synchronized blocks. For example, a Singleton can be implemented without concern for multiple threads inadvertently creating more than one initial instance. However, there are still cases in which one must watch out for race conditions, since ActionScript is full of event-driven callback mechanisms in which execution order cannot be known ahead of time (loading external assets and XML data, for example). In other words, while we don&#8217;t have to worry about two methods (or statements, for that matter) executing at the same time, or two threads executing the same method at the same time, we do still need to be concerned about the order in which methods execute. As far as I can tell, methods themselves can be guaranteed to execute atomically.</p>
<p><strong>No Method Overloading</strong></p>
<p>In Java, it&#8217;s possible to define more than one signature for a given method, varying based on the number, type, and ordering of parameters. In AS2.0, only one signature is allowed per method (including constructors). However, this disadvantage is offset somewhat by the fact that the AS compiler does not require that all parameters be specified when invoking a method; this allows us to write a method in which optional parameters follow required ones. For example, consider the constructor for the built-in Date object:</p>
<p><code>new Date(year, month [, date [, hour [, minute [, second [, millisecond ]]]]])</code></p>
<p>The Date constructor is written to accept seven parameters, but they are optional from least to most specific (right to left); that is, one could construct a Date by specifying only year, month, and date. In that case, the constructor would only see values for the first three parameters, and the rest would be undefined.</p>
<p>I&#8217;ll add more items to this list as I think of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/differences-between-as20-and-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using the event framework outside Components</title>
		<link>http://www.munky.net/software/flash-actionscript/using-the-event-framework-outside-components/</link>
		<comments>http://www.munky.net/software/flash-actionscript/using-the-event-framework-outside-components/#comments</comments>
		<pubDate>Sat, 21 Feb 2004 04:14:25 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=3</guid>
		<description><![CDATA[The v2 component architecture introduced a new event dispatching and handling framework, in which event objects are produced by components and consumed by whatever listeners are attached to them. For more information on this, refer to the Flash documentation under &#8230; <a href="http://www.munky.net/software/flash-actionscript/using-the-event-framework-outside-components/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The v2 component architecture introduced a new event dispatching and handling framework, in which event objects are produced by components and consumed by whatever listeners are attached to them. For more information on this, refer to the Flash documentation under &#8220;Using the event object&#8221;. The following sample code illustrates the basic principles.</p>
<pre>listener = new Object();
listener.click = function(evtObj) {
trace("Button clicked: "+evt.target);
}
myButton.addEventListener("click", listener);</pre>
<p>The myButton component generates a &#8220;click&#8221; event when pressed using the following code:</p>
<p><code>this.dispatchEvent({type:"click", target:this});</code></p>
<p>which creates a new (anonymous) event object (with the requisite type and target properties) and submits it to the event handling framework. The event framework then passes the event along to the listener object, which itself was previously registered as a listener for events of type &#8220;click&#8221; coming from myButton.</p>
<p>One very nice feature of the new event framework is that it is also possible to use it outside the context of v2 components. This can be useful, for example, when creating a modular application in which various elements need to communicate with one another yet making those elements into full-fledged components would be overkill.</p>
<p>Any object can be made into an event producer by invoking the EventDispatcher mix-in. A mix-in is a special class that dynamically adds methods and fields to a given object in order to expand its functionality. Such constructs are used liberally throughout the core classes in Flash MX 2004. Using the EventDispatcher mix-in adds the following methods to a given object:</p>
<p><strong><code>dispatchEvent(evtObj):Void</code></strong></p>
<p>Dispatches the given event object to the event framework, allowing it to be sent to any attached listeners</p>
<p><strong><code>addEventListener(eventType:String, handler):Void</code></strong></p>
<p>Registers the specified handler object as a listener for the specified event type coming from the current object</p>
<p><strong><code>removeEventListener(eventType:String, handler):Void</code></strong></p>
<p>Unregisters the specified handler for the specified event type</p>
<p>An additional method called dispatchQueue is also added, but that method is for internal use by the event framework.</p>
<p>In order to add these events to an object, simply invoke EventDispatcher.initialize:</p>
<pre>class MyCalendar extends MovieClip {

public function MyCalendar(Void) {
...
// this adds (mixes in) the dispatchEvent, etc. methods
mx.events.EventDispatcher.initialize(this);
}
...
}</pre>
<p>Once the initialize method is invoked at runtime, the MyCalendar class will have dispatchEvent and the add/remove listener methods, and will work just like any other event producer in the event framework.</p>
<p>One problem with the fact that the event methods are added through a mix-in at runtime is that the compiler won&#8217;t know about those methods while it is compiling the class. Therefore, if we just invoke dispatchEvent within the example class above, the compiler will generate an error since dispatchEvent isn&#8217;t defined within MyCalendar or within MovieClip, its superclass.</p>
<p>There are two ways to get around this problem. The easiest is just to define three additional class fields of type Function, one for each method that&#8217;s going to be added by the mixin:</p>
<pre>class MyCalendar extends MovieClip {

var dispatchEvent:Function;
var addEventListener:Function;
var removeEventListener:Function;

public function MyCalendar(Void) {
...
// this adds (mixes in) the dispatchEvent, etc. methods
mx.events.EventDispatcher.initialize(this);
}
...
}</pre>
<p>A slightly more rigorous method is to add a &#8220;stub&#8221; for each of the mix-in methods, which will be overridden once the mix-in attaches the real methods at runtime but will satisfy the compiler in the meantime. Write the stubs to throw Errors by default, just to make sure that the mix-in did in fact override those methods as expected:</p>
<pre>class MyCalendar extends MovieClip {

public function MyCalendar(Void) {
...
// this adds (mixes in) the dispatchEvent, etc. methods
mx.events.EventDispatcher.initialize(this);
}

public function dispatchEvent(evtObj):Void {
throw new Error("dispatchEvent method not overridden!");
}

public function addEventListener(eventType:String, listener) {
throw new Error("addEventListener method not overridden!");
}

public function removeEventListener(eventType:String, listener) {
throw new Error("removeEventListener method not overridden!");
}

...
}</pre>
<p>By doing this, the compiler will see that MyCalendar does in fact define the event methods, even though those methods will be overridden at runtime by the EventDispatcher class.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/using-the-event-framework-outside-components/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Useful undocumented properties of the Loader.progress event</title>
		<link>http://www.munky.net/software/flash-actionscript/undocumented-loader-event/</link>
		<comments>http://www.munky.net/software/flash-actionscript/undocumented-loader-event/#comments</comments>
		<pubDate>Fri, 13 Feb 2004 06:03:07 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=5</guid>
		<description><![CDATA[I discovered two useful undocumented properties of the event object emitted by the Loader class. <a href="http://www.munky.net/software/flash-actionscript/undocumented-loader-event/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Two very useful additional properties of the event object passed to the hander for the Loader.progress event are evt.current  (current number of bytes loaded) and evt.total (total bytes to load).</p>
<p>Example:</p>
<pre>var loadListener = new Object();
loadListener.handleEvent = function(evt) {
if (evt.type == "progress") {
trace("PROGRESS: "+evt.current+" of "+evt.total);
}
};
myFormOrSlideOrWhatever.addEventListener("progress", loadListener);
myFormOrSlideOrWhatever.load();</pre>
<p>Looks like the Loader component is probably based on the MovieClipLoader AS object. The MovieClipLoader.onLoadProgress entry in the docs mention the current and total properties of that event.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/undocumented-loader-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting styles for a component class</title>
		<link>http://www.munky.net/software/flash-actionscript/setting-styles-for-a-component-class/</link>
		<comments>http://www.munky.net/software/flash-actionscript/setting-styles-for-a-component-class/#comments</comments>
		<pubDate>Tue, 03 Feb 2004 06:08:25 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=6</guid>
		<description><![CDATA[Details on how exactly to set the default style for all instances of a particular component. <a href="http://www.munky.net/software/flash-actionscript/setting-styles-for-a-component-class/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The docs say that this can be used to set a global style for a particular component:</p>
<p><code>_global.styles.RadioButton.setStyle("color", "blue");</code></p>
<p>What&#8217;s not quite clear from this is that before doing that, you&#8217;d need to create the style object for the RadioButton class first:</p>
<p><code>_global.styles.RadioButton = new mx.styles.CSSStyleDeclaration();</code></p>
<p>Otherwise you&#8217;re calling setStyle on a null reference.</p>
<p>Also interesting to note is the fact that setStyle is not actually a method of CSSStyleDeclaration. I don&#8217;t know where it comes from, actually (UIObject? Some kind of mixin?). Therefore you can&#8217;t use strict typing on style objects if you&#8217;re going to call setStyle on them.</p>
<p><strong>Update:</strong> Got some more information on this from a response on FlashCoders. Turns out that setStyle does indeed come from a mixin &#8212; in short, UIComponent loads in UIComponentExtensions, which calls mx.styles.CSSSetStyle.enableRunTimeCSS(), which in turn causes the CSSSetStyle methods to be mixed in to CSSStyleDeclaration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/setting-styles-for-a-component-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Math.log() is really ln</title>
		<link>http://www.munky.net/software/flash-actionscript/mathlog-is-really-ln/</link>
		<comments>http://www.munky.net/software/flash-actionscript/mathlog-is-really-ln/#comments</comments>
		<pubDate>Tue, 13 Jan 2004 06:09:02 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=7</guid>
		<description><![CDATA[In AS2.0, the Math.log(x) function actually gives you ln x (base e). <a href="http://www.munky.net/software/flash-actionscript/mathlog-is-really-ln/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Note that the Math.log(x) function actually gives you ln x (base e). Luckily, high school algebra comes to the rescue. If you need log base 10, use</p>
<p><code>Math.log(x)/Math.LN10</code></p>
<p>which divides ln x by ln 10.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/mathlog-is-really-ln/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tree component&#8217;s change event</title>
		<link>http://www.munky.net/software/flash-actionscript/tree-components-change-event/</link>
		<comments>http://www.munky.net/software/flash-actionscript/tree-components-change-event/#comments</comments>
		<pubDate>Thu, 11 Dec 2003 06:10:46 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=9</guid>
		<description><![CDATA[When modifying a tree through its model, the change (selection changed) event won't always fire as it should. <a href="http://www.munky.net/software/flash-actionscript/tree-components-change-event/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When modifying a tree through its model, the change (selection changed) event won&#8217;t always fire as it should. For example, if you delete the currently selected node the selection will change to null but no change event will be dispatched. In cases like this you have to dispatch the change event manually using the component&#8217;s dispatchEvent method. For example:</p>
<p><code>tree.dispatchEvent({target:tree, type:"change"});</code></p>
<p>In general it&#8217;s best to use the event dispatching framework to manually fire the event from the component as shown here as opposed to just invoking the handler(s) directly. That way you don&#8217;t have to worry about keeping track of what handlers are listening to the component. Also, manually invoking a handler will cause the handler code to see a different value for &#8220;this&#8221; than if the handler had been invoked by the event framework, which may produce unexpected results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/tree-components-change-event/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Embedding fonts with TextFormat and component styles</title>
		<link>http://www.munky.net/software/flash-actionscript/embedding-fonts-with-textformat-and-component-styles/</link>
		<comments>http://www.munky.net/software/flash-actionscript/embedding-fonts-with-textformat-and-component-styles/#comments</comments>
		<pubDate>Thu, 11 Dec 2003 06:10:13 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=8</guid>
		<description><![CDATA[When using an embedded font with a custom TextFormat, remember that the embedFonts property of the text field to which the TextFormat is being applied must be set to true. The property defaults to false, so just setting the format of a TextField to a TextFormat containing an embedded font isn't sufficient for the embedded font to be used. <a href="http://www.munky.net/software/flash-actionscript/embedding-fonts-with-textformat-and-component-styles/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When using an embedded font with a custom TextFormat, remember that the embedFonts property of the text field to which the TextFormat is being applied must be set to true. The property defaults to false, so just setting the format of a TextField to a TextFormat containing an embedded font isn&#8217;t sufficient for the embedded font to be used.</p>
<p>For example:</p>
<p><code>var tfmt = new TextFormat();<br />
tfmt.font = "MyEmbeddedFontSymbol";<br />
myTextField.embedFonts = true;    // < -- critical!<br />
myTextField.setTextFormat(tfmt);</code></p>
<p>This also applies to fonts set through style properties. For example, if we have something like</p>
<p></code><code>_global.style.setStyle("fontFamily", "MyEmbeddedFontSymbol");</code></p>
<p>intended to set the global fontFamily style property for all components to use a custom font symbol, it&#8217;s necessary to set the embedFonts property as well:</p>
<p><code>_global.style.setStyle("embedFonts", true);</code></p>
<p>Without the above line, the specified font symbol will not be used in components as desired.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/embedding-fonts-with-textformat-and-component-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataSet filtering gotchas</title>
		<link>http://www.munky.net/software/flash-actionscript/dataset-filtering-gotchas/</link>
		<comments>http://www.munky.net/software/flash-actionscript/dataset-filtering-gotchas/#comments</comments>
		<pubDate>Tue, 02 Dec 2003 06:11:16 +0000</pubDate>
		<dc:creator>rdo</dc:creator>
				<category><![CDATA[Flash ActionScript]]></category>

		<guid isPermaLink="false">http://www.munky.net/?p=10</guid>
		<description><![CDATA[When changing the filter function on a DataSet, it is necessary to set the filtered property to false and then true again in order for the proper modelChanged event to be fired. <a href="http://www.munky.net/software/flash-actionscript/dataset-filtering-gotchas/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When changing the filter function on a DataSet, it is necessary to set the filtered property to false and then true again in order for the proper modelChanged event to be fired. Just changing the filterFunc property won&#8217;t cause the event to be fired.</p>
<p>Also, if there&#8217;s already a filter in place when the data loads in (modelChanged/updateAll), the filter won&#8217;t be applied until filtered is set to false and then back to true again (even if on immediately successive lines).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.munky.net/software/flash-actionscript/dataset-filtering-gotchas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

