PDA

View Full Version : Building a small pricing app/function to run in flash



feggymango
01-20-2006, 02:20 AM
Hello all, i am learning (struggling with) flash, right now(actually swish max, but i am going to get flash in a week or so) i am redoing my website, so it is all flash. Have just started to touch on actionscript. My site is jdmf contracting for my home improvement company, which does vinyl windows, doors, siding, decks, etc

I would like to set up a page whereby the customer would be able to get a rough estimate themselves by choosing from 1 of the 9(or so) styles of windows (maybe from a dropdownbox), enter the width and height of the window (to calculate sq ft) and have it generate an estimated price. Each style has a set sq/ft price.after i get them to input width and height, i would need to calculate their sq/ft and multiply it with their stlye selections price per sq ft. Also need to include a input box for "# of windows that size"-(generally on a house there are more than 1 at that size), and finally have it calculate a total for all of them. (

ex
style
1)slider($25sq/ft-example)
2)dbl slider($28sq/ft-example)
3)single hung($25sq/ft-example)
4)dbl Hung($28sq/ft-example)
5)casement($31sq/ft-example)
6)fixed($25sq/ft-example)
7)bay($33sq/ft-example)
8)bow($335sq/ft-example)
9)specialty($35sq/ft-example)

now i would not want them to see the prices on the styles, and i might need to change them once a year or so. I would also want them in a drop down box/listbox type. Since there are multiple window on a house at different sizes, i would need them to do this a few times, them make a total

ex how it might look

[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]
[style] [width]_____ [height]_______[#of units]

[Total]___________


also like to put an additional input text box for comments
and have this all emailed to me as well


Now, i have some database design experience and access experience, limited vb.net, limited vbscript, and just a tiny bit of c++.

Do I need to learn another language, or another database. I have no idea how to begin to approach this, as i am so new to flash. Is there a way to do this on flash so i do not have to have it go through a db/server, etc. If so, can someone refer me to a tutorial or a website where i can start to learn about this in detail. I am so confused.

If it cant be done in flash, which programs should i start to learn in order to do this. I am going to throw out names i have read about that might help and hope for some feedback-perl-php-asp-mysql

sorry for the longwinded explanation-its just i wanted to be clear on what i needed, i thought it might help with the advice, the more info you had
any ideas would be appreciated

thanks jeff

feggymango
01-21-2006, 03:59 PM
Hey all with flash, i am getting desparate. Any help will be appreciated. I have completed the form layout now.

http://img454.imageshack.us/my.php?image=estimatetry5ug.jpg


I have also placed all the labels,I need help with the programming/actionscript part-just to get me started

After they choose a style (I have populated the combo box with labels and corresponding values), they enter the width, height-i need a way to make it
take the width*height/144 then multiply that by the corresponding value i gave them in the combobox-ex single hung is 32 ($ a sq/ft)-then by the number of units and then place this amount in the last box in the row. If i can get help with the first 2 rows then i can do the rest.

I would also need help in taking the last box in each row, and calculating the sub, gst and total.

this is not homework or anything, i am not trying to scam anyone, its for my personal site, that i have to have up by wednesday.

I could email someone the fla file if the decie to give me a hand.
It is just over 2mb in size-flash 8

I am broke right now so i cant offer any money, but if you ever wanted any homeimprovements and you live in durham-you would defineatly be getting a deal from me..


thanks again
jeff

Tim
01-21-2006, 11:56 PM
your question needs far more time than I have.

However, if I understand what your asking, you are trying to have flash do the math based on values inputed in the form you made. Flash of course can do this, using simple math statements.

here's a quickie.
(www.actionscript.org do some tutorials to understand basic actionscript or you'll never figure this out.)

ie:

set some vars:

singleSlider_price = 25;
doubleSlider_price = 28;
singleHung_price = 25;

make a function to run for calculate

function calculatePrice(item, width, height, numOfUnits){
price = (width*height/144)*item;
//statement to return the price
}

on the calculate button,
on(release){
calculate(singleSlider, width, height, numOfUnits);
}

you'll have to deal with scope, refering to variables and functions on different timelines etc.

feggymango
01-22-2006, 12:33 AM
thanks for your help, the olny thing left i cant get, is when i made the combo box i entered the styles and for each corresponding styles i entered the value
ie single hung-label 32-value

how do i get to use the corresponding values of the selected item in the combobox, and incorporate it into my calculate function

i appreciate your help though

Tim
01-22-2006, 10:08 AM
you can retrieve the value set by the combo box with this line:

comboBox.selectedItem.data

you can get the text value from this:

comboBox.selectedItem.label

where comboBox is the name you set on the combobox component on the stage (has to be unique)

feggymango
01-22-2006, 12:39 PM
tried both of those and in the ouput window i keep getting "undefined"

Tim
01-22-2006, 12:57 PM
you have to make sure you have:

named the combo box. click on the combox on the stage, name it in properties, and "hit enter" (or click on the empty stage after)

make sure you have unique names for each combo box and refer to each one by name to get the value.

ie:
comboBox1.selectedItem.data
comboBox2.selectedItem.data
comboBox3.selectedItem.data
I would do a little look at a tutorial on variables, timelines etc. I don't know how knowledgable you are here.

make sure the path is correct, i the function is in a movieclip, you'll need to use the path to it, ie _parent.comboBox