<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Internal PreLoading in ActionScript 3</title>
	<atom:link href="http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/</link>
	<description>ClickPopMedia is a great little design and illustration firm.</description>
	<lastBuildDate>Wed, 24 Feb 2010 21:44:06 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: wizmaster</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-7884</link>
		<dc:creator>wizmaster</dc:creator>
		<pubDate>Thu, 15 Oct 2009 11:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-7884</guid>
		<description>for those who want to access the main timeline in actionscript 3.0 from anywhere in the code

http://www.adobe.com/devnet/actionscript/cookbook/timeline_root.html</description>
		<content:encoded><![CDATA[<p>for those who want to access the main timeline in actionscript 3.0 from anywhere in the code</p>
<p><a href="http://www.adobe.com/devnet/actionscript/cookbook/timeline_root.html" rel="nofollow">http://www.adobe.com/devnet/actionscript/cookbook/timeline_root.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gilles</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-5293</link>
		<dc:creator>gilles</dc:creator>
		<pubDate>Sun, 29 Mar 2009 11:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-5293</guid>
		<description>For those of you who encounter the #1009 Error, here is how I solved this problem : on the frame 3 (or whatever frame you have your app starting code on), you might have something like this :

import com.domain.myproject.MyMainClass;MyMainClass.main();

The problem is that this codes get called by the document class, that flash automatically creates (if you don&#039;t provide one) on first frame. Since this document class is created on first frame, anything it references is embedded on first frame. This means MyMainClass in the above example. And all the classes and symbols MyMainClass references...

This is how you end up with tens of kb on the first frame although you chose &quot;export classes in frame 2&quot;.

I think may be this also causes the link between linked symbols and their class to break, since the class is finally embedded on first frame, while the symbol itself is on frame 2 (or whatever). After this, when the class will try to use visual elements inside its symbol, it won&#039;t find it which will cause the #1009 Error (more or less).

The solution that worked for me (I found it really nicely explained weeks ago but I can&#039;t find the website again) : on frame 3, add an empty clip and move the instantiation code above inside it, and...

That&#039;s it! I think that&#039;s because only references that are on the main timeline of a movieclip (the document class extends MovieClip) must load on its first frame. The code embedded in nested clips gets loaded on the frame this clip appears. So that would be on frame 3 in our example, where we added this empty clip (but of course it will actually be on frame 2 since we asked &quot;export classes in frame 2&quot;).

Hope this helps !
Cheers,
Gilles</description>
		<content:encoded><![CDATA[<p>For those of you who encounter the #1009 Error, here is how I solved this problem : on the frame 3 (or whatever frame you have your app starting code on), you might have something like this :</p>
<p>import com.domain.myproject.MyMainClass;MyMainClass.main();</p>
<p>The problem is that this codes get called by the document class, that flash automatically creates (if you don&#8217;t provide one) on first frame. Since this document class is created on first frame, anything it references is embedded on first frame. This means MyMainClass in the above example. And all the classes and symbols MyMainClass references&#8230;</p>
<p>This is how you end up with tens of kb on the first frame although you chose &#8220;export classes in frame 2&#8243;.</p>
<p>I think may be this also causes the link between linked symbols and their class to break, since the class is finally embedded on first frame, while the symbol itself is on frame 2 (or whatever). After this, when the class will try to use visual elements inside its symbol, it won&#8217;t find it which will cause the #1009 Error (more or less).</p>
<p>The solution that worked for me (I found it really nicely explained weeks ago but I can&#8217;t find the website again) : on frame 3, add an empty clip and move the instantiation code above inside it, and&#8230;</p>
<p>That&#8217;s it! I think that&#8217;s because only references that are on the main timeline of a movieclip (the document class extends MovieClip) must load on its first frame. The code embedded in nested clips gets loaded on the frame this clip appears. So that would be on frame 3 in our example, where we added this empty clip (but of course it will actually be on frame 2 since we asked &#8220;export classes in frame 2&#8243;).</p>
<p>Hope this helps !<br />
Cheers,<br />
Gilles</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carol</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-3648</link>
		<dc:creator>Carol</dc:creator>
		<pubDate>Thu, 20 Nov 2008 21:36:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-3648</guid>
		<description>Hi

I tried my own code for the preloader but kept getting the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at crxPreLoader/::handleProgress()

Since it didn&#039;t seem to be working, I decided to try your code and hopefully I would understand what was wrong with mine. 

Well I copy-pasted your code into a new as file, commented all references to loadProg_MC and output_TF and then saved it in the same folder as my fla, which is empty and only has one line of code:
var preloadTest:ClickPopPreLoader = new ClickPopPreLoader()

When testing the file, I get the same error on ENTER_FRAME event:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at ClickPopPreLoader/::handleProgress()

If I replace the whole code at handleProgress function for a trace (like //trace(&quot;loading&quot;)) it works but of course, retrieves no loading info.

I am forced to think that the problem is in referrencing the stage at &quot;stage.loaderInfo.bytesLoaded&quot; but can&#039;t fgure out why.

It seemed to work fine for you as well for others in this thread, so I don&#039;t get it. What&#039;s wrong? I&#039;m using Flash CS3 Professional.</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I tried my own code for the preloader but kept getting the following error:</p>
<p>TypeError: Error #1009: Cannot access a property or method of a null object reference.<br />
	at crxPreLoader/::handleProgress()</p>
<p>Since it didn&#8217;t seem to be working, I decided to try your code and hopefully I would understand what was wrong with mine. </p>
<p>Well I copy-pasted your code into a new as file, commented all references to loadProg_MC and output_TF and then saved it in the same folder as my fla, which is empty and only has one line of code:<br />
var preloadTest:ClickPopPreLoader = new ClickPopPreLoader()</p>
<p>When testing the file, I get the same error on ENTER_FRAME event:</p>
<p>TypeError: Error #1009: Cannot access a property or method of a null object reference.<br />
	at ClickPopPreLoader/::handleProgress()</p>
<p>If I replace the whole code at handleProgress function for a trace (like //trace(&#8221;loading&#8221;)) it works but of course, retrieves no loading info.</p>
<p>I am forced to think that the problem is in referrencing the stage at &#8220;stage.loaderInfo.bytesLoaded&#8221; but can&#8217;t fgure out why.</p>
<p>It seemed to work fine for you as well for others in this thread, so I don&#8217;t get it. What&#8217;s wrong? I&#8217;m using Flash CS3 Professional.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-1806</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Fri, 05 Sep 2008 14:37:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-1806</guid>
		<description>I&#039;ve run into this problem before... or more specifically, someone else did and they also asked for help.
As I recall the flash player ignored all &lt;strong&gt;stop()&lt;/strong&gt; commands on frame 1.  It was the darnedest thing and I still don&#039;t understand why it does that.  I believe our solution was to put a &lt;strong&gt;stop()&lt;/strong&gt; on the second frame and push everything back an extra frame while stretching any preloader graphics out to the second frame.
If you have a lot of graphics to load on the second frame then this wouldn&#039;t be a problem.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve run into this problem before&#8230; or more specifically, someone else did and they also asked for help.<br />
As I recall the flash player ignored all <strong>stop()</strong> commands on frame 1.  It was the darnedest thing and I still don&#8217;t understand why it does that.  I believe our solution was to put a <strong>stop()</strong> on the second frame and push everything back an extra frame while stretching any preloader graphics out to the second frame.<br />
If you have a lot of graphics to load on the second frame then this wouldn&#8217;t be a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-1754</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 04 Sep 2008 15:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-1754</guid>
		<description>Hi.
I am using the &quot;internal&quot; preloader and I am having a problem with the movie starting to play before it jumps to a specific frame. How can I get the preloader to keep checking to see if all frames are loaded before it plays a specific frame?</description>
		<content:encoded><![CDATA[<p>Hi.<br />
I am using the &#8220;internal&#8221; preloader and I am having a problem with the movie starting to play before it jumps to a specific frame. How can I get the preloader to keep checking to see if all frames are loaded before it plays a specific frame?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-1330</link>
		<dc:creator>Matthew</dc:creator>
		<pubDate>Wed, 20 Aug 2008 12:41:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-1330</guid>
		<description>Hi Flashers--

I keep gettign this error:

&quot;
TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at MC_internal_class_fla::MainTimeline/UpdateProgress()
	at MC_internal_class_fla::MainTimeline/handleProgress()
&quot;

Has anyone found or know of a solutions for this? What does this mean?</description>
		<content:encoded><![CDATA[<p>Hi Flashers&#8211;</p>
<p>I keep gettign this error:</p>
<p>&#8221;<br />
TypeError: Error #1009: Cannot access a property or method of a null object reference.<br />
	at MC_internal_class_fla::MainTimeline/UpdateProgress()<br />
	at MC_internal_class_fla::MainTimeline/handleProgress()<br />
&#8221;</p>
<p>Has anyone found or know of a solutions for this? What does this mean?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-968</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Mon, 30 Jun 2008 19:29:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-968</guid>
		<description>Hi Paul,

I am pretty new to coding and I am having a problem when I use your preloader.  I have a Document Class (Main.as) set up. I set up the frames like you suggested up top.  My preloader is on the first frame with a class-name of PreLoader.  I have a few MovieClips that are not being exported on frame three (along with some that are being exported)..  The strange thing is that some of the clips that aren&#039;t being exported are null when the document class tries to access them... Is this some sort of timing issue with what gets loaded when?

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi Paul,</p>
<p>I am pretty new to coding and I am having a problem when I use your preloader.  I have a Document Class (Main.as) set up. I set up the frames like you suggested up top.  My preloader is on the first frame with a class-name of PreLoader.  I have a few MovieClips that are not being exported on frame three (along with some that are being exported)..  The strange thing is that some of the clips that aren&#8217;t being exported are null when the document class tries to access them&#8230; Is this some sort of timing issue with what gets loaded when?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-880</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Fri, 06 Jun 2008 17:22:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-880</guid>
		<description>Hi Paul, thanks for the reply - hopefully you&#039;ll see this and continue the discussion. Go ahead and bring it up on actionscript.org if you want!

You&#039;re right, I&#039;m not new to coding.

The problem with exporting my classes in the first frame is that they then add to the non-preloadable portion of the file, don&#039;t they? What if I have tens or hundreds of classes? That&#039;s why I want to load them all in a later frame.

:)</description>
		<content:encoded><![CDATA[<p>Hi Paul, thanks for the reply &#8211; hopefully you&#8217;ll see this and continue the discussion. Go ahead and bring it up on actionscript.org if you want!</p>
<p>You&#8217;re right, I&#8217;m not new to coding.</p>
<p>The problem with exporting my classes in the first frame is that they then add to the non-preloadable portion of the file, don&#8217;t they? What if I have tens or hundreds of classes? That&#8217;s why I want to load them all in a later frame.</p>
<p>:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-879</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Fri, 06 Jun 2008 16:25:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-879</guid>
		<description>Well Shaun, it sounds to me like you aren&#039;t new to coding or anything.  I figure anything I suggest may or may not work and this is going to take a little discussion.

If I may, I think we should bring this up in the forums over at http://www.actionscript.org/forums/forumdisplay.php3?f=75
(We are still working on our own forums, but they will be up soon too)

If and when you do start a new thread there, send me a PM @ TomMalufe (my alias on actionscript.org).  That is a great forum and site for AS questions and I go there all the time answering questions.  It&#039;s also the place where I originally learn how to make a preloader back when I was still coding in AS2.

I would think that you&#039;ve already tried this, but I don&#039;t usually export my classes in any frame except the first and I&#039;ve never had a problem (exactly) like this.</description>
		<content:encoded><![CDATA[<p>Well Shaun, it sounds to me like you aren&#8217;t new to coding or anything.  I figure anything I suggest may or may not work and this is going to take a little discussion.</p>
<p>If I may, I think we should bring this up in the forums over at <a href="http://www.actionscript.org/forums/forumdisplay.php3?f=75" rel="nofollow">http://www.actionscript.org/forums/forumdisplay.php3?f=75</a><br />
(We are still working on our own forums, but they will be up soon too)</p>
<p>If and when you do start a new thread there, send me a PM @ TomMalufe (my alias on actionscript.org).  That is a great forum and site for AS questions and I go there all the time answering questions.  It&#8217;s also the place where I originally learn how to make a preloader back when I was still coding in AS2.</p>
<p>I would think that you&#8217;ve already tried this, but I don&#8217;t usually export my classes in any frame except the first and I&#8217;ve never had a problem (exactly) like this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://www.clickpopmedia.com/2008/04/07/internal-preloading-in-actionscript-3/comment-page-1/#comment-874</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Fri, 06 Jun 2008 11:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.clickpopmedia.com/?p=239#comment-874</guid>
		<description>Hi. Having read lots of AS3 preloading articles, I still have a problem. Here&#039;s the setup:

- My movie has 3 frames. The first one is blank, the second contains an instance of every one of my library items that need linkage but aren&#039;t exported in first frame. I&#039;ve done this process for years.
- I export my classes in the 2nd frame, the same frame that I export my library assets. 
- I&#039;m using a document class called Preloader, which acts as the preloader. Once it&#039;s done waiting for bytesLoaded to hit bytesTotal, it does gotoAndStop(3), though I&#039;m not sure I need to do that. It then does: new Application(). The Application class is my game.
- I have, among other similar elements, a class, MenuButton, which has a library instance to go with it. Or, if you prefer to think of it the other way round, I have a MenuButton symbol in the library, whose class is contained in my class library that gets exported in frame two. In the linkage settings for my MenuButton, I have its Class as mygame.menu.MenuButton, and Base Class as flash.display.MovieClip. Export for ActionScript is the only check box checked.

My problem is that, in my Application class, when I go to create a new MenuButton (this is on frame 3 of the timeline), it&#039;s not attaching the MenuButton from the library. The MenuButton still exists - but it&#039;s only in the form of the AS file class - it doesn&#039;t have the graphical elements of the library item.

I first noticed this after a lot of confusion thanks to me trying to address a dynamic text field in my MenuButton library symbol. In my MenuButton.as constructor, I try to address this[&quot;iTF&quot;], and it wasn&#039;t working. This is because (and this is the way I imagine it, anyway) this[&quot;iTF&quot;] gets added to the class when it &#039;merges&#039; with the library symbol of the same linkage name.

So, I then thought that maybe I should export the classes before the library assets, or vice versa - export classes on 2, library instances on the stage on frame 3, and &#039;run the application&#039; on frame 4, that kind of thing. Neither combination of this seems to fix the problem, though.</description>
		<content:encoded><![CDATA[<p>Hi. Having read lots of AS3 preloading articles, I still have a problem. Here&#8217;s the setup:</p>
<p>- My movie has 3 frames. The first one is blank, the second contains an instance of every one of my library items that need linkage but aren&#8217;t exported in first frame. I&#8217;ve done this process for years.<br />
- I export my classes in the 2nd frame, the same frame that I export my library assets.<br />
- I&#8217;m using a document class called Preloader, which acts as the preloader. Once it&#8217;s done waiting for bytesLoaded to hit bytesTotal, it does gotoAndStop(3), though I&#8217;m not sure I need to do that. It then does: new Application(). The Application class is my game.<br />
- I have, among other similar elements, a class, MenuButton, which has a library instance to go with it. Or, if you prefer to think of it the other way round, I have a MenuButton symbol in the library, whose class is contained in my class library that gets exported in frame two. In the linkage settings for my MenuButton, I have its Class as mygame.menu.MenuButton, and Base Class as flash.display.MovieClip. Export for ActionScript is the only check box checked.</p>
<p>My problem is that, in my Application class, when I go to create a new MenuButton (this is on frame 3 of the timeline), it&#8217;s not attaching the MenuButton from the library. The MenuButton still exists &#8211; but it&#8217;s only in the form of the AS file class &#8211; it doesn&#8217;t have the graphical elements of the library item.</p>
<p>I first noticed this after a lot of confusion thanks to me trying to address a dynamic text field in my MenuButton library symbol. In my MenuButton.as constructor, I try to address this["iTF"], and it wasn&#8217;t working. This is because (and this is the way I imagine it, anyway) this["iTF"] gets added to the class when it &#8216;merges&#8217; with the library symbol of the same linkage name.</p>
<p>So, I then thought that maybe I should export the classes before the library assets, or vice versa &#8211; export classes on 2, library instances on the stage on frame 3, and &#8216;run the application&#8217; on frame 4, that kind of thing. Neither combination of this seems to fix the problem, though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
