Using MobileApplication to share data with first view

55 views
Skip to first unread message

Raymond Camden

unread,
Nov 16, 2010, 4:11:02 PM11/16/10
to adobe-air-...@googlegroups.com
So when using views in a Flex Hero mobile application, you can very
easily load a view and pass data along to the next view. I love that.
I'm trying to do the same but via the top level component. What I mean
is - my root MobileApplication has an initialize method. I want to
create a variable in there and when my first view is automatically
loaded for me, I want to pass the data to it.

I guess if I removed firstView I could simply load the view myself?


--
===========================================================================
Raymond Camden, ColdFusion Jedi Master

Email    : r...@camdenfamily.com
Blog      : www.coldfusionjedi.com
AOL IM : cfjedimaster

Keep up to date with the community: http://www.coldfusionbloggers.org

Raymond Camden

unread,
Nov 16, 2010, 4:23:28 PM11/16/10
to adobe-air-...@googlegroups.com
Hmpth, this doesn't quite work from the mobile app root;

navigator.pushView(views.TaskRunHome);

Gives me a null ref error in SlideViewTranslation.

Raymond Camden

unread,
Nov 16, 2010, 4:30:20 PM11/16/10
to adobe-air-...@googlegroups.com
Ok, I think I got it.

Apparently you can specify both a first view and the _data_ for the
first view. So I returned this to my mobileApplication tag:

firstView="views.TaskRunHome"

Then in my init function, I did this:

var ob:Object = new Object();
ob.dbfile = dbfile;
navigator.firstViewData = ob;

I'm not saying this is best practice - just what worked. ;) My init
function root ran and did it's crap, and I was then able to pass this
on to the first view.

Brian Rinaldi

unread,
Nov 18, 2010, 4:18:23 PM11/18/10
to adobe-air-...@googlegroups.com
This is great. Thanks Ray. You should consider posting this as a cookbook item. The mobile cookbooks are kinda sparse at the moment and something like this would be a very useful item. (I added similar ones over the past couple days)

Raymond Camden

unread,
Nov 18, 2010, 4:27:40 PM11/18/10
to adobe-air-...@googlegroups.com
Will do.
Reply all
Reply to author
Forward
0 new messages