ActionScript 2.0 :: Flash8 Numerical Sort - If The One Of The Numbers Has A Higher Digit Value, It Ignores The Statement Entirely?
Dec 17, 2009
I defined an array construct and assigned two variables to part of the array so I can simple sort it:
number1 = array[i]
number2 = array[i+1]
if(number1 > number2){
...swap etc
Problem is, when I try the comparason if the one of the numbers has a higher digit value, it ignores the statement entirely. Eg If 16 > 8 it skips it. So I tried adding '16' and '08' into the array and that worked perfectly with the statement.
View 2 Replies
Similar Posts:
Mar 17, 2008
how do I sort the list component by numerical values? At the moment, the sort sorts as follows 1 10 100 2 20 200 3 30 300...i want it to be 1 2 3 10 20 30 100 200 300...I am using the following code to accomplish this.[code].Is there a way I can reuse my listeners because basically the actions of the lists are the same...when you mouse over the elements I want the booths to highlight.when you click it zooms to a booth and highlights it something else...I am accomplishing this by duplicating the listeners [code]
View 2 Replies
Oct 24, 2005
Is there any way to force a two digit number with actionscript? Say, for instance, that I have a for loop that traces the numbers 1 through 9. In the output panel, I only get one digit numbers: 1, 2, 3,...9. Is there any way to make the trace output be 01, 02, 03,...09?
Obviously I could use an if statement to manually add zeros to all numbers that are less than 10, but is there a cleaner way to do it?
View 3 Replies
Dec 7, 2011
How do I find the digit sum of a floating point number?* (Eg Math.pow(10,100)). The correct answer would be 1. I have tried writing two functions, function A does not work for floating point numbers due to it converting numbers to strings, function B does not work for Math.pow(10,100) and other floating point numbers).
Specially: (1 with X zeros) % 10 = not 0, according to flash.
*Alternatively, what method can I use that gives me the last digit of a floating point number, and works for 1 with some number of zeros?
My functions:
private function getDSum(input:Number):Number {
var res:Number = 0;
for(var i = 0; i < input.toString().length+1; i++){
[Code]....
View 3 Replies
Jun 3, 2011
I am using Flash 8, and are building a game. It is an RPG-style game, and many people have been asking for a save game feature.I've been sifting through tons of tutorials and none work for me. I want to save a 'level' variable so that players can come back to it later on and pick up where they left off.[URL]
View 2 Replies
Jan 18, 2011
ok qiuck 1 how do make the random number generator start making as exaplme random numbers between 2 and 4. so it would select2,3,4 but o1 hope that makes sense
onEnterFrame = function(){
maths = Math.floor(Math.random() * 4);
trace(maths);
[code]....
View 1 Replies
Sep 19, 2010
I have an array that has mixed data of strings and integers and i want to sort it by the LAST element which is an integer:
myArray[string,string,integer,integer,string,integer]
View 1 Replies
Aug 28, 2010
Got a list of numbers in an array 7, 3, 8, 4, 3, 4, 4, 7, 9
But I need the output to be 3, 3, 4, 4, 4, 7, 7, 8, 9
How do I do this?
View 10 Replies
Jun 23, 2009
basically i have an xml file that is loading image paths to my loader clip, i need to modify the code to load a pdf in a new window aswell. I'm working alonge the lines of using an if statement, but i do not know how to define it to distingiush the pdfs from the jpgs.
function changePic(pict:Number):void {
pictURL = EXTxml.picture[pict].@image;
trace(pictURL);
if (pictURL == //ends in .pdf)
[Code]....
View 1 Replies
Jan 17, 2010
I'm Trying to sort an array firstly with QUANTITY then STOCK LEVEL using the code below. This is fine, the Quantity sorts perfectly but the negative numbers are reversed??
[Code]...
View 0 Replies
Jul 6, 2009
I have a datagrid. I add a row to the datagrid using an ADD button. Once I add, I sort the datagrid based on a column. I also provide the serial numbers i.e. row numbers as first column to the datagrid. But, the serial number function does not apply after sorting. Hence, a new row added for e.g. row 5, based on sorting should be row 1, the serial number displayed is still row 5. The UI looks bad as numbers are not in correct order. the code is:[code]
View 2 Replies
Mar 13, 2009
Is there a way to have more conditions in an "if" statement? For example I have 3 conditions:
condition 1: a=5
condition 2: b=3
condition 3: c=12
So, if a=5, b=3 and c=12, I want to trace("success") for example. But it's necessary that all 3 conditions are executed. How can I do that?
View 2 Replies
Nov 17, 2009
all i want to do is to enable a user to check that what they have written in an edit box is the correct answer or not
var element ("correct")
var element ("try again")
var element ("input") = "3"
if (input="3")
[Code]....
and what happens is no matter what is written in the edit box, "correct" shows up
View 1 Replies
Jan 7, 2007
I'm trying to use an if statement on a frame, but it doesn't seem to work do i need to put into some sort of function?
View 2 Replies
Oct 28, 2009
I am trying to add two numbers (num1 and num2) in Flash Pro 8. Every time that I try to add them I get a result of NaN in my answer box (ans instance, sum var)
The code in the Layer's Background is as follows
Code:
stop();
var num1;
var num2;
var sum;
[Code]......
View 1 Replies
Aug 1, 2009
How to get say from 1 to 10, three randomly chosen numbers but simultaneously exclude the possibility of a repeated return (ie two 2s or three 6s)?
View 8 Replies
Nov 11, 2009
Is there a way to store the number of the frame currently playing in actionscript, and then recall that frame number later?
View 1 Replies
Aug 21, 2009
I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.
[Code]..
View 2 Replies
Mar 25, 2005
I need help with page "Thumbs" (as first frame), page "List" (as second frame) and Image gallery (as third and base). So, every frame have one own XML file...When you choose some thumb or list line, you must came to this image in the gallery. Easy, sure.. but i don't know what Function exactly i need to use.It's one flash move, hence it doesn't work with getURL or loadMovie...Some exemple with 3 separate pages here: yuri.fr
View 1 Replies
Nov 27, 2010
I have an array that is structured like so.
[Code]....
Normally, I'd just like to sort the array alphabetically using the name field, which is easy enough using the following code. However, I'd like to create a radio button called 'loadedRadioButton' and when it's click on, I'd like to sort the array on the loaded value first(any items with loaded=true should be at the top, sorted alphabetically), then afterwards, any other items with loaded=false, sorted alphabetically should follow afterwards, how can I do it?
View 0 Replies
Mar 5, 2010
Here is a website that needs a sort function to sort the video by Last name. [URL] I would like to have a link that popped up videos sorted by last name. Please take a look at the following site for an example. [URL] When you click on seconds in the menu below, it opens a pop-up window that sort the videos in a certain way. If you are willing to,I will give you the source file of what it currently has on [URL]
View 1 Replies
Jul 3, 2010
I want to have a text with digit size of about 300, but at a certain digit size, when i increase the digit size more, it will not increase in the swf file (even though it will increase as i intended in the .fla file).Is there a max digit size, and if so, can i increase it, and if not, why is this happening?the textfield is a dynamic textfield made in the .fla file (so not in as3).
View 2 Replies
Dec 9, 2005
How do I isolate the last digit in a number. I.e. I have a variable called 'number' that is 24 and i want the 4 (The number never gets above 99)
View 5 Replies
Apr 22, 2008
I have this problem getting the numbers from a xml to flash because I only getting two-digit and hay need to get like 8 digit numbers and I dont know what happen.
Here is a example of the code:
var mybook:Number = 0;
var mymagazine:Number = 0;
var mycolor:Color = new Color(mccolor);
[Code]....
View 1 Replies
Jul 22, 2010
Is it possible to access a certain digit in a string? For example, if i currently had a value '321' then if i clicked on a button for example it changed the 2nd digit in the string to say 5...making it '352'.
This is probably really easy to do but im not sure how to do it!
View 5 Replies
Jan 7, 2011
how to specifically target the last digit all the way to the right of a number?For example, I have the numbers 113, 222, 1114, 318, 219 and I want to check if the last digit in the numbers equal 3, 4, 8, or 9.
View 7 Replies
Dec 21, 2008
i got an easy question that i couldn't find the answer to. what line of code do i need to use to change 123.456789 to 123.45.
code
oldNum = 123.456789;
newNum = ???
View 6 Replies
Oct 31, 2011
I use:
var gameScoreField:TextField = new TextField();
var gameScore:uint = 0;
gameScoreField.text = "Score: " + gameScore ;
[Code].....
If i use var gameScore:uint = 0000; the result will still return one 0, what can i do to make it 0000 instead?
View 5 Replies
Jun 30, 2011
When I get a collection back from the service tier, I create an ArrayCollection and apply a sort. When I add an item to the collection later on, the sort is still in place? It seems to be the case. I thought I was only sorting it once, not applying a sort that will stick??Here is the method for adding an item:
private function onAddNewClick():void
{
var fileTemplate:FileTemplateDetailDTO = new FileTemplateDetailDTO();
[code].....
View 4 Replies
May 7, 2010
I've recently downloaded the Flash CS5 and we wanted to upgrade license, but we experience VERY bad problem.Steps:
1. Create blank FLA AS 3.0 movie.
2. Add to first frame (stage), for example, TextArea component and name it "xxx".
3. Set in "Properties" window in "Component Parameters" tab:text - "hello world"maxChars - 10
4. Add script to first frame with next code:[code]
SO NUMERICAL PARAMETERS DON'T WORK! I not a new to Flash. Have worked more than 5 years with this. Also we've tested such behaviour with latest (downloaded today and yesterday) packages from OFFICIAL url...we've tested this behavoiur on different machines, with different operating systems.
View 26 Replies