Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-23-2012, 03:24 PM   #1
C0m4
Registered User
 
Join Date: Jun 2012
Posts: 6
Question Architecture issue

Hi

I'm writing a parking meter application - it must calculate the payment based currentTime minus parkingBegin time.
The app must be fool-proof, also.
I've created 4 input fields - one for every digit in 24h format, input fields are limited to 0-2,0-9,0-6,0-9.
To access these input fields i've used ENTER_FRAME event, which calls function which checks whether input1 is filled, than advances to input2 and so on, thus making it possible to only enter proper digits in proper cells.

the question is following: after each calculation attempt triggered by user entering digit in input4 and pressing enter, the entire procedure must be started over. What is the correct way to return/close all open functions/procedures/calls/whatever.
I have no experience in OOP - this is my first app, so my question might sound a bit dumb...
C0m4 is offline   Reply With Quote
Old 06-23-2012, 09:12 PM   #2
marlopax
Senior Member
 
Join Date: Aug 2008
Posts: 340
Default

Welcome C0m4

What are those 4 input field stands for?


ö
__________________
marlopax
marlopax is offline   Reply With Quote
Old 06-23-2012, 09:16 PM   #3
Scearezt
Satisfied User
 
Scearezt's Avatar
 
Join Date: Jun 2010
Location: C:\\System32\Hungary
Posts: 426
Lightbulb

You mean "Restart" the application? You can make a function to reset all variables, remove listeners & start over again.
Scearezt is offline   Reply With Quote
Old 06-24-2012, 12:39 PM   #4
C0m4
Registered User
 
Join Date: Jun 2012
Posts: 6
Default

2marlopax

thanx
4 input fields for 4 digits in 24h time format
ex. if user inputs 13:40 as a parking start time field input1 to input4 will have values of 1, 3, 4, 0 respectively.

2Scearezt
Yeah, restart the application.

I've created a function to reset vars and remove listeners.
so now i have calcStart() which calls calcDispatcher() which calls VariablesReset() which in turn calls calcStart() and so on on each program loop.

From what i know about programming this is not the right approach, however I'm not sure how to make it the right way.
C0m4 is offline   Reply With Quote
Old 06-24-2012, 03:48 PM   #5
marlopax
Senior Member
 
Join Date: Aug 2008
Posts: 340
Default

Why do user input the time?

Could you explain a little bit more and the full story of your application?


ö
__________________
marlopax
marlopax is offline   Reply With Quote
Old 06-24-2012, 04:29 PM   #6
C0m4
Registered User
 
Join Date: Jun 2012
Posts: 6
Default

The app is a parking meter. The user is cashier in an underground parking lot.
the program calculates payment based on the difference between the current time and the time user enters.

Anyway, I (think I) have figured out what was wrong, or rather how to do it right(or better) way.

Here is the code. it's working, handling input errors, etc. Requires some visual improvements and cleanup tho, will do a bit later.

pastebin . com / 8SVGrFmM
C0m4 is offline   Reply With Quote
Old 06-24-2012, 07:01 PM   #7
marlopax
Senior Member
 
Join Date: Aug 2008
Posts: 340
Default

The user should enter their Car Number and their Licence Number (optional) and when hit enter button, the application will store the arrival time with that user object. And when user leave, the application subtract it from the current departure time.


ö
__________________
marlopax
marlopax is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:19 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.