ActionScript 2.0 :: Calculator - Dividing Input Data Into Half?
Mar 2, 2003PHP Code:
half_btn.onRelease = function() {
output1 = input1/2;
};
I have that applied to a button.. but instead of dividing the input data in half.. it subtracts 2.
PHP Code:
half_btn.onRelease = function() {
output1 = input1/2;
};
I have that applied to a button.. but instead of dividing the input data in half.. it subtracts 2.
It is all working fine, except I cannot work out the code i need for the 'CE' or clear button. I want it to just clear the input fields ready for new data.I'm new here so don't know if theres a way I can send you the FLA, but the script is:
/* Calculator program, reads text from input (and validates text fields) and uses math class to display text at runtime
*/
[code].....
I'm pretty new to AS 3. I've been tasked with converting an online calculator from AS2 to AS3 and am having trouble figuring out how to get one of the functions to work. There are several input fields, restricted to numbers, which are ordered by tabIndex. When you enter a value and hit the 'Enter' key, it deletes the numbers the user just typed and focuses in on the now blank text field. What I need it to do is focus on the text field, and instead of deleting the text, select it.
Code:
txt1.tabIndex = 1;
txt2.tabIndex = 2;
txt3.tabIndex = 3;
txt4.tabIndex = 4;
txt5.tabIndex = 5;
[Code] .....
So I can create a circle and an oval using trig in flash. But what if I want to create an oval with rounder points? I'm using this code for circles and ovals:[code]Could anyone help me in editing the code so i can control the tips of the oval and make them rounder?
View 9 RepliesI have a movieclip with an image fading in and out (using an actionscript tween class set to yoyo). This movieclip is loaded into a dummy movieclip when a button is pressed. The first time you click the button the fading movieclip plays as it should, fading in and out continuously. However, the second or subsequent times the button is clicked the fading movieclip goes crazy, half fading in/out and half jumping from one alpha value to another.
View 7 RepliesBuilding a flash website in CS3. I've made every button the exact same way, draw a rectangle, convert to symbol, type as either button or movie clip (doesn't seem to matter and I'm not using rollover stuff), alpha 0% and stick it on its own layer above everything else.Action scrip is as follows:
main1.addEventListener(MouseEvent.CLICK, gotoMain);
main2.addEventListener(MouseEvent.CLICK, gotoMain);
function gotoMain(event:MouseEvent):void
{
gotoAndPlay(1);
}
that's with 2 buttons for main. I have the exact same code multiple times for many different buttons. It works everywhere except the last two buttons on my page will work the first time you click them from the main page, but then don't work after that until you click on the main page again. Then it works.These two:
babout3.addEventListener(MouseEvent.CLICK, gotoAboutb1);
bcontact3.addEventListener(MouseEvent.CLICK, gotoBcontact1);
the function is described on an earlier action keyframe:
bcontact1.addEventListener(MouseEvent.CLICK, gotoBcontact1);
function gotoBcontact1(event:MouseEvent):void[code]...
Of course I've tried just having one button do this and copy/pasting the button on different areas of the movie, but nothing I've done fixes. I've even gone through and deleted every button and AS and redone it. I've put every button on its own layer (shouldn't matter but I'm trying everything I can think of).if there is an easier way of using AS to navigate a flash movie let me know. The other options I've seen seem a bit too complex at the moment.
The first half of the tween doesn't work but the second half does. It only does this when I add the code link._visible = 0;. This is to make the alpha completly disappear.
View 1 Repliesim trying to create a conversion utility that uses number input via calculator style buttons to generate conversion for the following distances:
-Miles to/from KM
-cm to/from mm
-binary to/from decimal
Now i was thinking of possibly having the options contained within an drop down and an input text field where the numbers are entered via the calculator buttons. The only thing im struggling with is how to perform the actual calculations on the different formats. Has anyone had to do anything similar in the past? Ive only found currency conversion examples and not sure how to apply that to these conversions.
I'm making a calculator using Flash MX that works the same way as the basic calculator found on windows (not the scientific one). But having the user input a number, store it as a variable, store which function the user wants to perform and clear the text field then store the new input in the same text field as a different variable and multiply or add or divide or subtract the 2 numbers and getting the equals sign to display the answer when clicked is harder than I thought it would be.
View 3 RepliesI have a string that looks like this:
"assets/images/1.jpg;assets/images/2.jpg;assets/images/3.jpg";
how can i create an array that pushes each link in it and removes the ;?
something like this:
var images:Array = {assets/images/1.jpg,assets/images/2.jpg,assets/images/3.jpg};
I have an image of a human body which needs to divided into Hexagonal Grid pattern and the hexagons should be highlighted on mouse rollover and also clicks. It will be time consuming if I make these hexagons manually coz they will around 1000 in numbers.
Also, I need to zoom the hexagons on clicks.
I often need to divide quantities in recipes. Normally, this is straightforward: I have an array of items to divide and a total, so I can do something like
[Code]...
However, this time I have been handed a curve ball: some of the items have a maximum amount they can be. For example, item A has a maximum amount of .25, item B is maximum of 1, the other items have no limits. So if the total amount is 3, and I am dividing it by 3 items I can't simply set each one's amount to 1 (as I normally would, as the code above does). I need to set the amount of A to .25 so there is still the .75 "left over" that I now need to apply evenly to the remaining items.
So that means the other 2 items B and C would be 1.375 each -- but, as I said above B also has a limit (of 1), so B would be 1 and C (no limits) would get the whole .75 remainder, and be 1.75. So A=.25, B= 1, C=1.75 for the total of 3. My question is, even conceptually, how would I approach a problem such as this in AS?
[Code]....
I am doing the following in actionscript in Coldfusion Flash Forms:
90 / 3.7
Gives me:
24.3243243243243
Whereas the calculator gives me:
24.32432432432432
Note the extra 2 at the end.
So my problem occurs when I am trying to get the original value of 90 by taking the 24.3243243243243 * 3.7 and then I get 89.9999999999 which is wrong.
Why is Actionscript truncating the value and how do I avoid this so I get the proper amount that the calculator gets?
i would like to know if it is possible to have a letter that is made up of multiple colors. for example above you will see a hebrew letter. the DOT underneath it is actually part of the letter, but it is a different color.is it possible to have this same functionality in flash? what i would need to do is upload an XML file with all the words, and i would need all the dots below the letters to be a different color
View 2 RepliesI have a site with an SWF that I can put some metrics into, such as ZIP Code, Weight, etc.. then, it takes that info and gives me shipping rates.
I need to build a front-end site that I can have a forms page that will push data to the backend SWF, and then return the data back from the SWF to the front end.
Front-end -> SWF (Zip Code, Weight, Size) -> *Calculates* -> Front-End
That should be the flow.. So I need to send data to the backend, GET the data that it calculated, and return the results to my front-end.
Compare input text with imported XML data problem
View 1 RepliesI am trying to calculate the values on user entered text fields (which only accept numbers) along with the values of user selected combo boxes. I have a function to a button:
reviewQ.calcBtn.addEventListener(MouseEvent.CLICK, calcAns);
function calcAns(e:MouseEvent):void
{
reviewQ.calcAns_text.text = "Your calculated result is " +
[Code]....
Right now, all I am getting is the actual values entered in the text fields and selected in the combo boxes. How can I get the sum of this values to show on my "calcAns_text.text"?
Want to have input text box were it is a 11 digit number (a track and trace type lookup)... when user puts in 11 digits, it will redirect to url that contains info on that inputted value.[code]...
View 7 Repliesi hvae a username inputbox in layer 1 frame 1 witha submit button on submit button i have the following script on (release)
[Code]...
1)the button when pressed once nothing is displayed , i need to click it second time to get the data from the input field
2)if someother value is enterd in the input box & submit button clicked , the value of dynamic text doesnot change how do i resolve the following
I'm sorry this is a question from a server ignoramus, I've previously captured user input using a combination of cfml and text files. That was way back in 2002 and using AS 1.0. I'm now working in an environment where the server guy won't put any scripts on, and I mean none, no PHP, no ASP, no CFML, nothing. Would anyone know if there is a way of capturing user input without using a script, please? This prolly shows a really basic lack of understanding of how servers work but I'm a bit desperate. I know the Flash Learning Interactions can work with SCORM and pop results into LMSs that use SCORM and our LMS does use SCORM, but it seems to only be within the learning interactions and I don't know where to start to tailor this for the input I need to capture.
View 2 RepliesI have the following scenario: I'm loading data values from an external XML file and I want to swap them with other ones in order to show the latter further on in the movie. As an example, I have the following data in the XML file:
Code:<set label='Epson'><set label='Hitachi'><set label='Toshiba'><set label='Mitsui'><set label='Panasonic'><set label='Canon'><set label='Lexmark'>and I want to swap the following data
[code]........
I am using an mx:DateField in Flex and it works nice with the date picker, but I also need it to be editable, so I set editable="true". The problem is that now the user can enter anything they want - even though I have a formatString="YYYY-MM-DD" set. The date picker honors this format, but if the user enters in the format MM/DD/YYYY they can - or they can even enter garbage data.
I realize I can set up a data validator to check that it is a valid date and in the appropriate format as per the flex docs, but I was hoping to have something I have seen in other languages where the text field would show something like "0000-00-00" and the user clicks in to the field and it allows them to change only the digits (the zeros) and can not type any alpha characters or add/remove any length.
I need to have a data field that the user will enter in a zip code, hit submit, and have a specific movie clip load, based on their entry. There aren't different movie clips for every single zip, but there will be 20 or so different clips that would load, based on whether or not that zip falls within a certain group. For instance, if someone enters in a zip for Washington DC, I would need to load a clip that shows that general area ... DC, VA and MD.
View 0 RepliesI'm trying to figure out how to retrieve a data or text from a text input field? what im talking about is, i have a text input field which i can enter some text then, i have a button where when i pressed it, the data or text that i have inputted on my text input field will be added and can be shown on a dynamic text field.
View 5 RepliesI'm sure it's easy to do, but I just cannot figure it out. I've created a timer but want to let the user set default values to start at so they don't have to modify the start time each time the program starts.I was able to create a text box but it is un-editable in the actual program. It displays '00' nicely but it's useless. I haven't even gotten to the point where the data is pulled and stored.
ActionScript Code:
var timerHrs1:TextField = new TextField();
timerHrs1.type = TextFieldType.INPUT;
[code]......
give me a example of a fla file where we can input our data and the data will be save using flash MX?
View 3 Repliesi want a solution or sample file of exactly how to save a flash input data to xml file.. im really new to xml.. i dont know how to script it in flash. Ex: there will be a two fields of input... 1) text input... 2)checkbox input/ other... and a submit/ save button the above will be in flash interface.... so when i run the file and key in the data into the text input box or other.. the data what ever i key in has to reflect in XML that means it has to save the data in XML... so that i can open the xml and have look of the data wat ever i have keyed in..
im really badly in need.. what action to put where and how to create xml. what to put in that... i know some of you really would have done this.
I want to read data from HTML input box.
Code:
<inpyt type="text" name="telephone" value="+4404574" id="tel">
How I can read telephone value with ActionScript?
I'm building a sidescrolling world where you can move around.The idea is that you should be able to move to any point in the world, as well as travelling really fast.I'm pregenerating a long list of data about objects to place, their positions etc.
Now. When moving to a point far away from current position I don't want to loop through the whole list of objects to find what objects should be seen and not, so I'm thinking I should divide the position list into sections, each covering an area equal to the visible area. That way I would only have to roll through the lists closets to the new position.This would however result in an array of thousands of elements each consisting of about 20 objects and I'm figuring that might not be very healthy.One solution would be to split everything up further so that in the end I would have a handable nr of arrays containing a handable nr of elements.
You're probably thinking I should generate positions on the fly, but since one place in the world can be revisited I need to store all positions.
Is there a way to input data in to vector3d instance same way like when creating the new vector3D instance (example 1), instead of doing it separately for each axis (example 2).
example 1
ActionScript Code:
var vec:Vector3D = new Vector3D(1,2,3);
[Code].....