Persistent Data

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Persistent Data

bilbosax
I have some components that I need to instantiate where a user will use dropdowns and sliders and textinputs to choose values that they need to search.  When the search begins, I want to destroy the components so that they are garbage collected, but I want the values for the various inputs to persist so that when I instantiate the component again, I can set it to it's last values.  What structure do you guys like to use most to do this?  I was considering Flex Globals, but I have heard there are more sound ways of doing it.  Could you give me your suggestions? (i do not want to store them in a sqlite database)

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

Benjamin Povirk
Im using a simple static variables in a class named AppVars for such "app lifetime" stuff :)
eg
public final class AppVars
{
public static var CurrentUserPermissions:ArrayCollection;
... //more app static memory
}

and then using AppVars.CurrentUserPermissions in the application

On 28 Feb 2017, at 01:08, bilbosax <[hidden email]<mailto:[hidden email]>> wrote:

I have some components that I need to instantiate where a user will use
dropdowns and sliders and textinputs to choose values that they need to
search.  When the search begins, I want to destroy the components so that
they are garbage collected, but I want the values for the various inputs to
persist so that when I instantiate the component again, I can set it to it's
last values.  What structure do you guys like to use most to do this?  I was
considering Flex Globals, but I have heard there are more sound ways of
doing it.  Could you give me your suggestions? (i do not want to store them
in a sqlite database)

Thanks



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Persistent-Data-tp14735.html
Sent from the Apache Flex Users mailing list archive at Nabble.com<http://Nabble.com>.



SAMO NASLOVNIKU! / ONLY FOR THE INTENDED RECIPIENT!

Opozorilo: Ta elektronska pošta vsebuje informacije, ki so lahko zaupne narave in so namenjene samo naslovniku. Če je bilo zaradi napake v naslovu ali pri prenosu sporočilo poslano drugam, prosimo, da o tem obvestite njegovega avtorja. Če sporočilo ni bilo namenjeno vam, ne smete uporabljati, razkriti, širiti, kopirati, tiskati ali kakorkoli uporabiti informacije v sporočilu.

Disclaimer: This e-mail contains proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

bilbosax
Interesting.  Using Flex the way that I do, I have never had to write my own class before.  I will look into it more online.  Do the variables have to be static to do it this way?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

Benjamin Povirk
Yes, they have to be static and I think they are faster this way too, else you would need to implement singleton.

> On 28 Feb 2017, at 20:26, bilbosax <[hidden email]> wrote:
>
> Interesting.  Using Flex the way that I do, I have never had to write my own
> class before.  I will look into it more online.  Do the variables have to be
> static to do it this way?
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Persistent-Data-tp14735p14738.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.



SAMO NASLOVNIKU! / ONLY FOR THE INTENDED RECIPIENT!

Opozorilo: Ta elektronska pošta vsebuje informacije, ki so lahko zaupne narave in so namenjene samo naslovniku. Če je bilo zaradi napake v naslovu ali pri prenosu sporočilo poslano drugam, prosimo, da o tem obvestite njegovega avtorja. Če sporočilo ni bilo namenjeno vam, ne smete uporabljati, razkriti, širiti, kopirati, tiskati ali kakorkoli uporabiti informacije v sporočilu.

Disclaimer: This e-mail contains proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

Olaf Krueger
In reply to this post by bilbosax
bilbosax wrote
 Could you give me your suggestions? (i do not want to store them in a sqlite database)
Sounds like it's time to separate your model from your view ;-)
As Benjamin said it's a good idea to persist your data by using some AS3 classes that represents your model.
Probably there're countless aproaches how to achive this.
By implementing this and other typically stuff to separate the concerns by yourself you maybe end up with the decision to use one of the frameworks out there which already solved a lot of things for you (e.g. PureMVC, Parsley, Swiz, ...).

However, one simple approach to just resolve your current issue could be to inject a model object [1][2] to your view.
You have to implement a public variable e.g. var myModelVO:MyModelVO at your view to achive this.

HTH,
Olaf


MyModelVO.as:

[Bindable]
public class MyModelVO
{
        public var searchItem:String;
        // ...
}

MyView:
<<view:MyView myModelVO="{new MyModelVO()}" >




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

bilbosax
Olaf, you have given me a lot to think about, and a lot to look up and read.  I am programming out of necessity, not because I am a professional coder unfortunately.  So I have stumbled across a lot of MVC discussions while browsing the web, but have never really tried to implement it myself.  A mistake, I am sure, but I am usually looking for the quickest way to a solution rather than the industry practice.

Looks like it is time to learn :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

Olaf Krueger
>Looks like it is time to learn :)

Sounds like the right path ;-)

My recommendation regarding a MVC framework is still PureMVC [1] cause:
- There's an awesome documentation available, including a book written by Cliff Hall [2]
- There a lot of examples out there [3]
- There're some useful utilities available
- It suports modular programming
- It comes with a simple but powerful notification system
- It's feature frozen
- It's still alive and supported the community and by its author Cliff Hall [4]
- It was ported to a lot of other programming languages
- It's pure.... PureMVC contains of just a few classes and interfaces
- You could use if with FlexJS out of the box

HTH,
Olaf

[1] http://puremvc.org/
[2] http://shop.oreilly.com/product/0636920022459.do
[3] https://github.com/PureMVC/puremvc-as3-multicore-framework/wiki
[4] http://forums.puremvc.org/


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Persistent Data

jmclean
Administrator
HI,

For simple application which I assume this is I would just suggestion breaking up the application in a data model, views and use binding to display the data from  the model in the views, display custom event form the views to change the data and you have MVC without using a framework.

I suggest not using PureMVC as it is generic and thus IMO not the best fit for Flex. I have use it and many other frameworks in Flex before - but others may have different opinions.

Thanks,
Justin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: [Non-DoD Source] Re: Persistent Data

Kessler CTR Mark J
I agree with both Justin and Benjamin on this.  Keeping it simple and easy to use for your particular use case.  Adding in a static class to store the properties in and using data binding where needed sounds like the shortest and easiest path for now.


-Mark

-----Original Message-----
From: Justin Mclean [mailto:[hidden email]]
Sent: Wednesday, March 01, 2017 4:07 AM
To: [hidden email]
Subject: [Non-DoD Source] Re: Persistent Data

HI,

For simple application which I assume this is I would just suggestion breaking up the application in a data model, views and use binding to display the data from  the model in the views, display custom event form the views to change the data and you have MVC without using a framework.

I suggest not using PureMVC as it is generic and thus IMO not the best fit for Flex. I have use it and many other frameworks in Flex before - but others may have different opinions.

Thanks,
Justin
Loading...