Better way to begin a robotlegs project in flash

rei_itchido's Avatar

rei_itchido

13 Dec, 2011 03:26 PM

Hi,

i'm just looking for an advice, i just begin to work with robotlegs and my matter is :

after my bootstrap for initialise command/mediator/injection, i just want to begin graphical implementation, but where ?

in the MainContext?
or in the Main.as (where i have initialise the _context = new MainContext(this);)

thank's

  1. 1 Posted by krasimir on 13 Dec, 2011 03:31 PM

    krasimir's Avatar

    Hello,

    actually there is no big difference between working with flash or flex. Think about Robotlegs as a basic structure/layer of your application/site. It's just a nice tool which will connect all the parts. The graphical things should be in the views, by my opinion. Everything which is related to the visual parts should be managed by the views.

  2. 2 Posted by Wagster on 13 Dec, 2011 04:42 PM

    Wagster's Avatar

    The contextView is the root display object. Create some views (which inherit from Sprite) and add them to the contextView. That's about it I think.

  3. 3 Posted by prankard on 14 Dec, 2011 12:00 AM

    prankard's Avatar

    Congratulations. You are almost there.
    By the sounds of it, you've done the hard part of your application.
    There are two ways I like to do this, both do the exact same thing but depends on preference.
    1. Once you've mapped everything you need. At the end of the main context class, add a new view (It'll probably be one you've mapped to a mediator) to the public variable 'contextView' ie:
    contextView.addChild(new MyView());
    And if the "MyView" has a mediator paired it will be fired up too. I do this in small apps.
    2. I often try to fit most adding of my views in commands. As 'when' I act upon my application 'then' my application changes. So I map an "StartupEvent" to a "StartupCommand" and then dispatch an event from the MainContext and then get my command to add views to the public property 'contextView'.

  4. 4 Posted by rei_itchido on 14 Dec, 2011 10:15 AM

    rei_itchido's Avatar

    First of all, thank's

    So if i have right understanding, the common thing of all your point of view, is to addView directly in the contextView;

    My processing actualy is this one :

    in context, startup(),
    i set my bootstrap, at the end i hear ContextEvent.STARTUP_COMPLETE, which is link to the command StartupCommand.

    this one, make a contextView.addchild(new MainView).

    i think i'm in the good! thank's a lot.

    Another question, in flash, do you think i have to put the position x and y at the moment where i contextView.addchild(new MainView), or in the class MainView? (sorry i'm a newbie, but i just want to learn to do fine)

  5. 5 Posted by prankard on 14 Dec, 2011 12:09 PM

    prankard's Avatar

    Hi Rei,

    Again, it's up to you. Your view positioning code really should be inside the view.
    That way, when you make a new 'view' it's all aligned up correctly.
    However, it should also be able to be positioned globally.

    Say you make a new 'CarDashboardView'. That CarDashboardView, would make 'CarSpeedometer' and position it to the left hand side (x=0) then make 'CarGasMeter' and position that to the right of the speedometer (x = 100).

    You can set the initial positioning in the commands but my fist view is usually 0,0 positioning.

  6. 6 Posted by rei_itchido on 14 Dec, 2011 01:39 PM

    rei_itchido's Avatar

    the first view is set in 0,0, but after i can put an another view {videoPlayer} in x:250, y :25, and the third {videoButton} in x250, y:150?

  7. rei_itchido closed this discussion on 16 Dec, 2011 10:45 AM.

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