tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/749-better-way-to-begin-a-robotlegs-project-in-flashRobotlegs: Discussion 2018-10-18T16:35:35Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/120828132011-12-13T15:31:10Z2011-12-13T15:31:27ZBetter way to begin a robotlegs project in flash<div><p>Hello,</p>
<p>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.</p></div>krasimirtag:robotlegs.tenderapp.com,2009-10-18:Comment/120828132011-12-13T16:42:23Z2011-12-13T16:42:24ZBetter way to begin a robotlegs project in flash<div><p>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.</p></div>Wagstertag:robotlegs.tenderapp.com,2009-10-18:Comment/120828132011-12-14T00:00:37Z2015-01-27T17:34:26ZBetter way to begin a robotlegs project in flash<div><p>Congratulations. You are almost there.<br>
By the sounds of it, you've done the hard part of your
application.<br>
There are two ways I like to do this, both do the exact same thing
but depends on preference.<br>
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:<br>
contextView.addChild(new MyView());<br>
And if the "MyView" has a mediator paired it will be fired up too.
I do this in small apps.<br>
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'.</p></div>prankardtag:robotlegs.tenderapp.com,2009-10-18:Comment/120828132011-12-14T10:15:56Z2011-12-14T10:15:57ZBetter way to begin a robotlegs project in flash<div><p>First of all, thank's</p>
<p>So if i have right understanding, the common thing of all your
point of view, is to addView directly in the contextView;</p>
<p>My processing actualy is this one :</p>
<p>in context, startup(),<br>
i set my bootstrap, at the end i hear
ContextEvent.STARTUP_COMPLETE, which is link to the command
StartupCommand.</p>
<p>this one, make a contextView.addchild(new MainView).</p>
<p>i think i'm in the good! thank's a lot.</p>
<p>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)</p></div>rei_itchidotag:robotlegs.tenderapp.com,2009-10-18:Comment/120828132011-12-14T12:09:18Z2015-01-27T17:34:26ZBetter way to begin a robotlegs project in flash<div><p>Hi Rei,</p>
<p>Again, it's up to you. Your view positioning code really should
be inside the view.<br>
That way, when you make a new 'view' it's all aligned up
correctly.<br>
However, it should also be able to be positioned globally.</p>
<p>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).</p>
<p>You can set the initial positioning in the commands but my fist
view is usually 0,0 positioning.</p></div>prankardtag:robotlegs.tenderapp.com,2009-10-18:Comment/120828132011-12-14T13:39:19Z2011-12-14T13:39:19ZBetter way to begin a robotlegs project in flash<div><p>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?</p></div>rei_itchido