Making lemonade with Flex

This post is more than 2 years old.

Ok, so this isn't the most useful example of Flex, but I have a soft spot for the old Lemonade Stand Apple IIe game of my youth. I rebuilt it with Flex:

http://ray.camdenfamily.com/demos/ls/main.html

It still has a few quirks, but have fun. I've also included the source code as an attachment to this zip. Please note that I'm very much a Flex newbie, so don't consider my code as anything even near "Best Practice".

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Steve Walker posted on 11/11/2006 at 5:21 PM

Ray,

Thanks for the example. I couldn't wrap my brain around binding data to different components and this showed me the way.

example: http://www.berkeley-county....

Comment 2 by Steve Walker posted on 11/11/2006 at 5:22 PM

There was a mistake in the url of my example. Should be: http://www.berkeley-county....

Comment 3 by Raymond Camden posted on 11/11/2006 at 7:45 PM

Awesome - I'm glad my trivial little game could help someone. :)

Comment 4 by SteveG posted on 11/11/2006 at 9:09 PM

*yelling* I remember this! I remember this! *sighing* oh man i remember this... starting to feel old here Ray, but thanks for making me feel like a kid again if only for a moment. -s

Comment 5 by Joe Rinehart posted on 11/12/2006 at 5:40 AM

Crap, and I was going to try to get some code done when my wife's out of town....now I'll just sit and work on my citrus-beverage cartel.

Very nice, Ray!

Comment 6 by Aaron West posted on 11/13/2006 at 1:45 AM

Too fun. I'm at $1,400 in assets now! You need to increase the max number of cups beyond 999!! ;-)

Comment 7 by Jon Alexander posted on 1/11/2007 at 8:43 AM

Hi, am also new to Flex. Please question: How do I start / initialize my application with a custom dialog / Alert box that I wish to use for login plus a site description .swf like your lemonade example, please.

Jon Alexander
sales@e-revenues.com

Comment 8 by Raymond Camden posted on 1/11/2007 at 4:51 PM

Don't forget I included the zip with this blog post. If you download it and take a look, you will see how I'm launching that panel on application startup. (I use creationComplete.)

Comment 9 by Jon Alexander posted on 1/11/2007 at 8:35 PM

Thank you, shall have a look at the zip file. Am hoping this shall have a dialog / Alert Box whereas the main app is out of focus on starting, the purpose is to have a login box ontop of the main app showing first, with the main app in back but out of focus.

Thank you

Jon

Comment 10 by Raymond Camden posted on 1/11/2007 at 9:50 PM

You want to see my other Flex demo:

http://ray.camdenfamily.com...

Comment 11 by Jon Alexander posted on 1/11/2007 at 10:43 PM

Hi, thank you. I saw that one, thank you.

As your private function checkForm(), shows the Alert.show on error when the usernameValue ==''

This Alert dialog box, shows as a pop up while the main login (or in my case a desired main app) in the background as fuzzy.

The closest I have found for a visual example is the Mystic Support Ticket by Peter Ent, please note it is not working due to the Coldfusion connection to MySql, BUT, it does present an exact visual representation of what I hope to accomplish:

http://www.e-revenues.com/p...

htaccess username is: erev
htaccess password is: hi93Lj48

PLEASE REMOVE THE HTACCESS part after you have a chance to maybe jot it down.

But in this example you can see the login with the main app in the background faded out, but I hope to have a fuzzy'ed out look.

So one first arrival on my web site, the main app is in the background but the login dialog pop up is on top with the main app fuzzy'ed out.

Thank you.

Very sorry to take up your time, any thoughts would be most gratefully appreciated.

Jon

Comment 12 by Jon Alexander posted on 1/12/2007 at 2:28 AM

ok, may have figured it out, but stuck on one last part below is the code from which the main app calls a TitleWindow named MyLoginForm.

The part I am having difficulty is HOW to NOT need to use the mx:Button click="showLogin()

BUT instead have the showLogin() be performed when the app runs

<!-- main.mxml -->
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.core.IFlexDisplayObject;
private function showLogin():void {
var helpWindow:IFlexDisplayObject =
PopUpManager.createPopUp(this, MyLoginForm, true);
}
]]>
</mx:Script>
<mx:Button click="showLogin();" label="Login" x="307.5" y="269"/>

Comment 13 by Jon Alexander posted on 1/12/2007 at 3:36 AM

Hi, maybe getting closer. I believe it may be that I need an onShow() with the creationComplete.

When the screen is shown, the creationComplete event calls the onShow() function to display the TitleWindow on top of the main app.

Any ideas, please?

Jon