AssetLoader: loaded property

HomeForumsAssetLoaderI Need Help!AssetLoader: loaded property

This topic has 3 voices, contains 7 replies, and was last updated by  Matan Uberstein 297 days ago.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
July 16, 2011 at 1:55 pm #728 Quote

nodinosaur
<p>Hi, </p>
<p>I am having a slight issue, where it appears that the ‘loaded’ property in not being set correctly.</p>
<p>I am using @soundstep’s flavor of AssetLoader</p>
<p>in brief I am loading various assets, a background JPG, a few images JPG’s and an SWF.<br />
I am creating a loader for each, adding that to assetLoader using addLoader and<br />
adding event handlers to the particular loader</p>
<p>trimmed down code looks like this:<br />

Code:
<br />
[Inject]<br />
public var assetLoader : IAssetLoader;<br />
private var _pageLoader : IAssetLoader;</p>
<p>function load() : void {<br />
var loader : ILoader;<br />
_pageLoader = new AssetLoader ( model.currentPageId );<br />
_pageLoader.numConnections = 1;<br />
assetLoader.addLoader ( _pageLoader );</p>
<p>loader = new ImageLoader ( new URLRequest ( background_source ) , "BACKGROUND" );<br />
_pageLoader.addLoader ( loader );<br />
addBackgroundLoaderListeners ( loader );</p>
<p>loader = new SWFLoader ( new URLRequest ( swf_source ) , "SWF" );<br />
_pageLoader.addLoader ( loader );<br />
addSwfLoaderListeners ( loader );<br />
}<br />

</p>
<p>The listeners are added in

Code:
addBackgroundLoaderListeners()

and

Code:
addSwfLoaderListeners()

and simply dispatch events for the progress &amp; completion.</p>
<p>When I want to access the assets again and test for assetLoader.loaded it seems to always return a false, when can see that the assets have infact all loaded.</p>
<p>I am sure I am doing something wrong here, can anyone point me in the right direction?</p>
<p>Thanks,</p>
<p>George
</p>

July 16, 2011 at 2:05 pm #821

Matan Uberstein

Have your tried using the ALLogger’s explode method to see if all the assets are loaded? Call the explode at the point you think everything should be loaded, then paste the response in your next reply to this thread.

Thanks!
Matan

July 16, 2011 at 2:14 pm #822

nodinosaur

sure , seems the SWF loader isn’t being invoked:

1

/** EDIT**/

Just realized, 1 is why the SWFLoader is not invoked, however I would assume that the SWFLoader is invoked after the previous loader is complete, however traces do not show me this

Changing it to 1 the SWFloader IS invoked and using traces I can see that the asset is Loaded

July 16, 2011 at 2:51 pm #823

Matan Uberstein

This is really weird behaviour, if _pageLoader has two child loaders and you invoke _pageLoader.start() with numConnections set to 1, the first loader should complete and then the second. This is something that’s unit tested, so it must work. I’ve also used numConnections set to 1 in personal projects and while testing.

Where are you calling start on your _pageLoader?

July 16, 2011 at 5:46 pm #824

nodinosaur

**UPDATE**
There is a BUG in SoundSteps version of the Native Event based version of AssetLoader v2.3.4

I have just updated my source to use the Signals variant and it works flawlessly

Sorry about this

July 18, 2011 at 8:04 am #825

soundstep

I’ll have a look.

July 18, 2011 at 8:26 am #826

Matan Uberstein

Let me know if I can assist you with anything. I was looking through the event version’s source and I could not find anything incorrect, or at least that relates to this problem.

July 26, 2011 at 7:45 pm #837

Matan Uberstein

Flagging as resolved.

Problem was caused by calling event.stopImmediatePropagation() on child loaders complete events. This stopped the parent IAssetLoader from receiving the complete events, thus resulting in the loading queue to stop.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.