dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: MVC - Preloading!?

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    20

    MVC - Preloading!?

    Hi guys,

    This is my second post here, and thanks to all those that have helped, you've been invaluable, however I have run into a problem..

    I am using as3 to develop an application in MVC, using Flash Builder (formerly flex) and have been searching for days to find out how to preload external content and views in an MVC application.

    From my research so far I currently have a function on the document class that creates and preloader and preloads any content before any views are created.. this seems logical to me, but I was wondering.. where do I put all this preloaded content once I have passed it through the preloader?

    I mean, I have sounds and images in an external xml file, as well as views to preload.. firstly, assuming I do put the images and sounds through the preloader... once these are preloaded, where do I keep them? Do I add every Loader to an array in the model, to store it as a reference for each view to access? or is it enough that I just preload them into memory?

    Also, I am confused as to how I can preload 'views' in mvc if the preloader is instantiated before I create any views... how can I preload something I havent defined yet?

    Any advice would really help,

    Tom.

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    [On Request]

    As MVC has many ways to do and it all depends on the application and the developer’s team, it is difficult to tell the actual. But there is a general concept of Preload in Background which means that all the assets and the text of other views can load in background when the users is looking on some other view of the application. Now the question is where to load all this data before initiation that particular view? No matter the views are initiate or not you can always preload it on declaration that view class, and put all the assets into its own methods or structure (if you design MVC for each view). By doing that you can easily clear the memory then ever you remove that object. Other option is to store all the assets in a separate class in your core MVC structure. That might be an AssetStorageClass, which stores all the assets for each view in predefined or dynamically created Array or Object, so that you can keep the data even when you removed the object. By this structure you have to load the data once and never have to load it again on that current running of it. You can keep control of the loading for memory issue by making a list of how much to load in first run and what to do when the other assets will load.

    By nature of MVC Pattern it is always better to make loose coupling between patterns and object and its own structure. You might find better than I described over here. If you can able to make a simple sample, I can try to give my best out of my knowledge.

    Regards




    marlopax
    Last edited by marlopax; 10-17-2011 at 02:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center