Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Where does asset loading go and how does view component knows about loaded file?  (Read 8961 times)
ck
Newbie
*
Posts: 3


View Profile Email
« on: August 04, 2008, 01:04:22 »

Hi all,

first of all, thanks for the framework. I started working with PureMVC (AS3) a couple of weeks ago and I really like it.

Working on a Flash project I got into some trouble handling assets. Basically I don't really know where the different parts have to go to.

My app should to the following:

1) Loading XML/CSS
2) Startup
3) Navigation mediator is created (buttons will load different pages)
4) Click on button will create new page mediator
5) The page view component needs to load different images/swfs to be displayed
6) some more images will have to be loaded into a nested view component just after user interaction

1 - 4 is working fine. Now I'm stuck. Do I have to create a AssetProxy, dispatching events from the view components to request specific images/swfs? How does the view component finally gets to know when the image is loaded?

I also read the Thread about the StartupManager but somehow I didn't get it how to use this as a AssetLoader :(

Thanks in advance.
ck
« Last Edit: August 04, 2008, 01:09:59 by ck » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: August 04, 2008, 01:29:29 »

For the moment, check this out:

http://revisual.co.uk/?p=80

-=Cliff>
Logged
ck
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: August 05, 2008, 04:30:57 »

… already saw this before … well, now finally got it how it works :) Just had to change cause the new LoadingStatus feature ;)

But I have one problem. The Event.COMPLETE will never be thrown. IOErrorEvent.IO_ERROR works fine though. I am using the latest svn rev. Did you change the complete event?

If I add a trace to the LoaderEvent class it prints out loadItemCompleted, but how to listen to that one?

cheers
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: August 05, 2008, 06:03:22 »

Sorry, latest svn rev of what? And Event.COMPLETE thrown from where?

-=Cliff>
Logged
ck
Newbie
*
Posts: 3


View Profile Email
« Reply #4 on: August 05, 2008, 06:09:03 »

Sorry, latest version of the assetLoader utility. Below the code with the addEventListeners. It's pretty much the same to your test unit, just with the newly introduced LoadInfoStatus.

:
while (n < list.length) {
asset = loaderProxy.getAsset(list[n].url as String) as IAssetInfo;

if (asset.status == LoadInfoStatus.READY)
{
asset.clientType = list[n].client;
asset.addEventListener(Event.COMPLETE, onRessourceLoaded, false, 0, true);  // <== this one is never thrown
asset.addEventListener(IOErrorEvent.IO_ERROR, onRessourceFailed, false, 0, true);

loaderProxy.addToQue(asset);
assetMap[n] = asset;
} else {
// nothing yet
}
n++;
}
Logged
Pages: [1]
Print