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: [Loadup Utility] Reference to UIComponent  (Read 6104 times)
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« on: September 25, 2009, 02:41:33 »

While working with the Loadup Utility I realized that the three classes AssetOfTypeImage, AssetOfTypeSwf, AssetOfTypeText, implementing IAssetForFlex all make direct references to UIComponent. It first add unwanted weight to a pure ActionScript application and probably introduce problems to compile it from Flash IDE.

The reference to this three classes is not a problem in itself as they are intended to provide helpers for Flex components.

The problem is more that even if the utility implements an Asset Factory, the class AssetTypeMap make a reference to this three concrete class instead of letting the user choose the concrete class to build.

Here is the incriminated references in AssetTypeMap

:
39         protected function defaultMap() :Object {
40             var obj :Object = new Object();
41             obj[ Loadup.IMAGE_ASSET_TYPE ]     = [ AssetOfTypeImage, AssetLoadByLoader ];
42             obj[ Loadup.TEXT_ASSET_TYPE ]      = [ AssetOfTypeText, AssetLoadByURLLoader ];
43             obj[ Loadup.SWF_ASSET_TYPE ]       = [ AssetOfTypeSwf, AssetLoadByLoader ];
44             return obj;
45         }


To be honest, now, I don't have much time to explore this deeper. For my current needs, I simply modified the AssetTypeMap class to initialize its constructor with my own "defaultMap" which did not contains any UIcomponent reference.

But I'm sure we can do it better with a good implementation of an Abstract Factory where only the user create the client class which will decide to use or not use the UIComponent in the assets it needs.
Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« Reply #1 on: September 25, 2009, 05:13:01 »

I investigated the problem a little deeper and I found that the Loadup AssetFactory is already well written and so you can create your own AssetTypeMap without having to modify the existing AssetTypeMap  class as there is a IAssetTypeMap interface and no refereence to the concrete AssetTypeMap exists in the utility. This is exactly what I was looking for.

Now, the problem is real with the default class and I suppose that a good thing would be to rename the exisiting AssetTypeMap to FlexAssetTypeMap. For my part as my project is pure ActionScript I will have to create a PureAsAssetTypeMap. If the result is interesting I could post a Pure Flash example for Loadup with the required AssetTypeMap/MapToLoaderContext/MapToURLRequest for Pure ActionScript projects. It could be added to the project later.
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #2 on: September 25, 2009, 05:25:35 »

Tek, thanks for the above posts on Loadup and AssetTypeMap.  I'm sure the Pure AS version of the class would be useful to people.
----Philip
Logged
akineton
Newbie
*
Posts: 1


View Profile WWW Email
« Reply #3 on: October 20, 2009, 07:39:30 »

Hi guys!

Thx for the PureMVC framework.

If the result is interesting I could post a Pure Flash example for Loadup with the required AssetTypeMap/MapToLoaderContext/MapToURLRequest for Pure ActionScript projects. It could be added to the project later.

Tek,
did you succeeded with your Pure Flash example?

I managed the LoadupAsOrdered_2_0 migration to Pure Flash, but the LoadUpForAssets not yet. Before I start to digg into it, it would be great to know if you already have something ready. :-)

Thx,
Akos
« Last Edit: October 22, 2009, 06:04:50 by akineton » Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« Reply #4 on: October 23, 2009, 10:47:43 »

I already have a working version of it, I don't remember if the integration was complete. I need to integrate it in an example project. I will try to do it this week-end. If I can't finish it, I'll send you a PM to give you a link to the last version of it.
Logged
Pages: [1]
Print