Loader with progress

Bart's Avatar

Bart

18 Sep, 2010 01:47 AM

Hi

I am new to RobotLegs, so far I have manage to get some test going, I would ideally like to have a loader clip, with my mini app, but not sure how I would go about this, within the Robotlegs frameswork.

Would I need to put the function within the context.

  1. 1 Posted by Stray on 18 Sep, 2010 10:59 AM

    Stray's Avatar

    Hi Bart,

    I'm not 100% clear on what you're asking here.

    But - as some guidelines to get you going:

    1) Any loading would normally be done by a service (mapped as a singleton, or a singletonOf the service interface).

    2) The loading would be kicked off by a command mapped to an event.

    3) If this is the first thing you want to happen in your app, you should map the command to the ContextEvent.STARTUP_COMPLETE event.

    4) When the loading is finished, the service should dispatch an event to say that it is done. You'll probably want to put what you loaded on that event as a payload.

    5) You can either map another command to this event, and carry out your next steps in this command, or you can map a mediator to your contextView, and listen for this event in that mediator, and carry out your next steps (adding what you've loaded to the view for example) there. Don't forget you'll need to mediate it manually because the contextView is already on the Stage.

    The choice of whether to pick up an event in a mediator, or map it to a command, is pretty simple:

    - If you have to do something that uses models or services, or you have to transform the event to a new type of event, you need a Command.

    - If you just need to do things that involve the view, pick it up in a mediator.

    6) In your case it sounds like you'd also have a progress indicator while the mini-app loads. This would be a view with a mediator, and you would then listen for progress events fired from the loading service in the mediator, and act as required on the view.

    These are just general guidelines - robotlegs is pretty flexible so you can work it however you want, but if you take this as a starting point you won't get into trouble. It might seem like a lot of code and classes, but generally typing is actually quicker than thinking, so it'll save you some head-scratching.

    Golden rule: the Context is just a place to map the relationships required for injection and the mediator and command maps. Don't do ANYTHING else in your Context.

    (Like all rules, there are times when this can be broken but if you're just getting started and finding your feet then I'd stick to the guidelines for now.)

    Hope that helps,

    Stray

  2. 2 Posted by Bart on 18 Sep, 2010 02:00 PM

    Bart's Avatar

    Hi Stray

    You've touched on a bit on what I am asking for, in a nutshell what I want to do first is to have to a main app loader screen with progress bar view (ideally with percentage). Only when all loading is complete (including all the views that I will use later on), it can fire off an event either to a command or like you pointed out in my case a mediator.

    I hope that's more clearer

    Thanks Stray

  3. 3 Posted by Stray on 18 Sep, 2010 05:40 PM

    Stray's Avatar

    Hi Bart,

    in that case you should have what you need to get going. If you need the loaded swfs to be able to communicate with each other, or the main app, you need to check out modular robotlegs - Joel Hooks has a fork on github.

    Let us know if you have a specific problem,

    Stray

  4. Stray closed this discussion on 10 Feb, 2011 05:48 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac