What Are Bitwise Operators And How/why Do You Use Them?
Hi there, i came across these things called bitwise operators. After some research i didnt get any further than the fact that they alter bits directly. Then i read something on shifting bits and stuff, and that this would be more efficient it this got me confused. Can you use them to optimize your code? Can someone give some examples of this, like a function and his alternative (using bitwise operators)?
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 11-19-2004, 06:45 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Bitwise Operators
Could someone explain to me what increment or decrement bitwise operator is? What are some uses for it and why is there always an "i" in it, can it be changed for something else or does it have to be an i?
What Are Bitwise Operators And How/why Do You Use Them?
Hi there, i came across these things called bitwise operators. After some research i didnt get any further than the fact that they alter bits directly.
Then i read something on shifting bits and stuff, and that this would be more efficient it this got me confused.
Can you use them to optimize your code?
Can someone give some examples of this, like a function and his alternative (using bitwise operators)?
Bitwise Operators
I would like to start using flag-like properties in some of my classes that work in a similar way to the static Array properties:
Array.CASEINSENSITIVE or 1
Array.DESCENDING or 2
Array.UNIQUESORT or 4
Array.RETURNINDEXEDARRAY or 8
Array.NUMERIC or 16
One or more of those values can be passed to the Array.sort() method using the bitwise OR operator...
ActionScript Code:
myArray.sort( Array.NUMERIC | Array.DESCENDING )
My question is: Given that the value passed to the sort() method will be a single number, how can you tell which Array.parameter values were used?
Hope that makes sense. I'm still not up-to-speed on all of this bitwise operator stuff.
(HELP) Bitwise Operators
I've just started learning about Bitwise Operators for Actionscript, so
this book is getting into 32-bit integers (binary). I don't understand
how to translate binary into base-10 numbers.
(i.e. 0000 0000 0000 0000 0000 0000 0000 0011 = 3)
Below is a formula that the book gives using the "&" bitwise operator. Can anyone please explain, or point me in the right direction so I can figure how they came to this conclusion. If I am unclear of my problem, please let me know.
//Here is the formula
x = 1234
y = 4567
z = x & y;
(answer: z = 210)
All help is greatly appreciated!
Bitwise And Hex
I've been reading in wikipedia about bitwise operations, but everything is related to binary code. From the stuff I have seen here, bitwise operations are used mainly with hex.
I understand them (as much as I can) in binary, but can someone give a simple clear, example how it relates to hex? > >> |
EDIT: reading http://www.adobe.com/devnet/flash/ar...rators_02.html and will ask questions when done.
Bitwise Tutorial
Can anyone recommend a good bitwise shift (>>) tutorial I keep getting stuck on it
About Bitwise Shifting
Is bitwise shifting quicker than regular division in flash?
In CC++ it is very fast way to divide a number by 2^n number. But flash has do some conversions first so I am not sure if this operator is faster than regular division.
So, is this:
MyNumber >> 2;
faster than:
Math.floor(MyNumber / 4);
And by the way how fast are math and function calls when compared with CC++ and Java. I know that flash is much slower than C, but how slower? Can it be compared with Java? I know that drawing in flash is abominably slow becouse of vector graphic and stuff, but I do not know about very language.
thank you
Bitwise/logical ? *
what is the difference between a bitwise operator and a logical operator, for example
And
ActionScript Code:
(_xmouse and _ymouse);
and
&
ActionScript Code:
(_xmouse & _ymouse);
Bitwise Programming
I think it would be great if you guys can post a tutorial on bitwise programming.
I have read books like moocks but didnt find them very helpful
Bitwise NOT Operator
I was reading this: http://www.macromedia.com/devnet/fla...rators_03.html
and it says:
Quote:
With a bitwise NOT operator, I would get 6 back. This is because the bitwise NOT flips each bit in the binary representation of 9 separately, so 1001 (9 in binary) becomes 0110, which is 6 in decimal.
However:
ActionScript Code:
trace (~9);
traces: -10
Am I misunderstanding something here? How does this bitwise operator operate exactly??
What Is The | (the Bitwise OR Operator) Used For?
Greetings everyone!
Working my way through the book "Flash MX 2004 games most wanted" from Friend of Ed.
The book assumes a bit more AS knowledge than I have atm so I'm using a lot of time checking every bit of code - making sure I know what is going on on each line. In one of the program codes (one that makes a tile-based gameboard) I've come across the bitwise OR operator written in AS as |. What is the use of this operator? In the Flash 8 AS helpfile it says:
expression1 | expression2
Converts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits of either expression1 or expression2 are 1. Floating-point numbers are converted to integers by discarding any digits after the decimal point. The result is a new 32-bit integer.
They also give the following code example:
// 15 decimal = 1111 binary
var x:Number = 15;
// 9 decimal = 1001 binary
var y:Number = 9;
// 1111 | 1001 = 1111
trace(x | y); // returns 15 decimal (1111 binary)
Problem is I can't wrap my head around the logic of this operator - example: why does the code above output 15 and not something else? Basically my question is this: how does | work? And how is it usefull to me when writing code?
Any hints to this are more than welcome!
Bitwise Gems
http://lab.polygonal.de/2007/05/10/b...-integer-math/
very fast bitwise operations are in AS3 compared to standard operations
cool stuff from polygonal
Bitwise Programming
I think it would be great if you guys can post a tutorial on bitwise programming.
I have read books like moocks but didnt find them very helpful
Bitwise Signs
Im looking for a explanation for this:
this bitwise signs, for what i ll use it?
what is a integer of 32 bits?
thanks
this is really new for me
marcelozep
Problems With Using Bitwise/bitmasking?
I've done some research into this bitwise solution of storing multiple properties under one variable but now I'm having problems with checking which properties are set. Here's the code I'm working with atm:
Code:
var walkable = 0x01;
var pickup = 0x02;
var water = 0x04;
var hole = 0x08;
var flags = walkable;
if (flags&0x0f == 0x0f) {
trace("true")
}
Now as I understand (flags&0x0f == 0x0f) should check if all conditions are true, so in the case of 0x0f it checks for walkable, pickup, water, and hole. But if you run this code the trace will return true.
I played around with it some and discovered that the walkable property was maybe the problem but then I tested: var flags = pickup | water | hole, with: (flags&0x0e == 0x0e). 0x0e being pickup+water+hole.. and well that didn't return the trace.
Any ideas of what I'm doing wrong? maybe this is not the approach I should be taking?
Bitwise Operator Question
Could someone please tell me what the big deal is concerning bitwise operators >> and << ?
I ask, because I saw some code recently that used them and while I understand the basic principle of dropping the least significant bits on the right or left to change a number, what are the real world benefits for doing this?
Up to this point, I've never personally used them for the intermediate-complexity things I do with Flash.
Thanks in advance
Bitwise Logical Ops On Src/dest. Bitmaps
Those familar with the C/C++ world should understand what I mean by bitwise logical operations, i.e. performing logical AND, OR, NOT on the bits of a src and destination value to get a result.
Those familiar with Win32 GDI and BitBlt know that it allows ROP codes which enable the bits of a source and destination bitmap to be combined using bitwise logicial operations as above. So for example, the ROP code SRCAND would combine a source and destination bitmap using a bitwise logical AND operator on the binary bits of the two bitmaps.
I need to do the same thing if possible in either actionscript or flex. I know flex has high level blendmodes for combining src and destination such as BlendMode.OVERLAY BlendMode.DIFFERENCE, (but no BlendMode.AND, BlendMode.OR). There is actually a BlendMode.INVERT which would be the same as NOT (so why would AND and OR be left off). Actionscript has the BitmapData class with methods like CopyPixels, which is essentially the same as Win32 BitBlt, except without any sort of ROP bitwise logical ops apparently.
With all the various type of complex masking you can do in actionscript, I find it hard to believe that no basic bitwise logical ops between source and destination bitmaps are possible. Is there a way to do them?
Thanks.
Pb With Operators
hi, i have the following variables:
nb_con1
nb_con2
these variables have got a value (i check this with a dynamic field that print the values)
i'm trying to make this:
var nb_conx=nb_con2-nb_con1;
if (nb_conx==1) {
writer.start();
}
but the result of nb_conx is always 0...why? i'm becoming crazy soon...
thx for your help
Help With Operators
In PHP I can do this with strings:
if (src) { status2 = src; } else { status2 = "0"; }
if (src > "") { status2 = src; } else { status2 = "0"; }
They don't seem to work. How can I check to see if a string contains something?
John
OPERATORS Question
what´s the difference between:
if (variable == true) {
}
and
if (variable = true) {
}
and the same with:
if (variable == false) {
}
and
if (variable = false) {
}
String Operators
hey, i was wondering what the script would be to rip a certain string from another string.
ex. i have name=movie.mpg, i want variable extension to equal .mpg based on the name and then a third variable named title which would be just movie. so basically
my guess w/o syntax:
name="movie.mpg"
extension=name.split(???)
title=name subtract ".mpg"
so u can kinda see my idea? well thanks in advance for any help. also an explanation of the ne, lt, le, gt, ge operators and what they do. thanks.
Darn Operators....please Help
It seems i have a problem, i just learned variables and expressions in flash 5, so having a VERY basic knowledge of it, i decided to make a little "store" to practice this new knowledge.Well here is my dilema:
dollars = 0;
dollarx = 100 * dollars;
cents = 0;
total = dollarx + cents;
Thats what i have in my actions...(this shows the default total for the store, and says that every dollars should be multiplied by a hundred....6 dollars x 100 = 600 + 89 cents = $6.89. that is why i multiply it by a hundred, i know no easier way) Well anyway, to get back on topic, if dollars = 6 and cents = 89 the total variable would = 689 which, obviously, is not a dollar value....How would i go about making the 689 into $6.89? Being a newb i thought this would work:
total = "$" & dollarx "." & + cents;
But unfortunately it doesnt, is there another way to write it?(Yeah i know this question is idiotic...to all you master flash artists)
Comparison Operators
Hi Everyone,
I am about this... Any clues???
I am loading a text file into a dynamic textfield named "text"
I am trying to check if "text" is empty
if (_root.text ne ""){
_root.gotoAndPlay("end");
}else{
_root.gotoAndPlay("start");
}
Right now I am using 'ne' because it works when I use this, (and I know that it is deprecated) BUT, when I use '!=' it doesn't work.
Someone please shed some light as I don't want to have to use any deprecated items.
Thank you!
Variables And Operators
What am I missing with operators evaluating variables here? When the value is explicitly named, it works fine. When the value is referred by variable name, it always selects the "if' statement.
Why does this function work correctly:
function comPare() {
if (percent2comp >= 10) {
percent_comp = percent2comp;
} else {
percent_comp = percent_comp;
}
}
While this one does not:
function comPare() {
if (percent2comp >= percent_comp) {
percent_comp = percent2comp;
} else {
percent_comp = percent_comp;
}
}
Thanks
Operators Problem
I'm currently doing a project for trigonometric where user will key in a number for an angle, and it will generate it's SINE, COSINE and TANGENT.
Code:
// used for translating between angle units
trans = Math.PI / 180;
// position of origin
sin_angle = Math.sin(Number(_root.angle)*trans);
cos_angle = Math.cos(Number(_root.angle)*trans);
tan_angle = sin_angle/cos_angle;
//simplify the number to 4 digit only
sinA = Number(Math.round(sin_angle*100)/100);
cosA = Number(Math.round(cos_angle*100)/100);
tanA = Number(Math.round(tan_angle*100)/100);
After this, there will be 3 textfield for user to key in the answer, sin_ans, cos_ans and tan_ans.
I've use this script to check for the answer
Code:
on (release) {
//checkAnswer 1
if (_root.sinA == _root.sin_ans) {
trace("sin = true");
} else {
trace("sin = this is very wrong");
}
//checkAnswer2
if (_root.cosA == _root.cos_ans) {
trace("cos = true");
} else {
trace("cos = this is very wrong");
}
//checkAnswer3
if (_root.tanA == _root.tan_ans) {
trace("tan = true");
} else {
trace("tan = this is very wrong");
}
}
It work nicely with a certain number but not all. Even tough user key-in the correct number, but the output still turn to be false.
I wish to know why and what's my problem. Sorry, i'm still a Noob in actionscript.
Thanks in Advance.
Stephen
Overriding Operators
Hi!
Is it possible in Flash 8 to override operators (like in C)?
Take for example the flash.geom.Point class...
var a:Point = new Point(10, 20);
var b:Point = new Point(5, 10);
var c:Point = a + b // instead of a.add(b);
trace (c) // traces (15, 30)
Thanks, bye!
Operators In Variables
Hi,
Using Flash MX v. 7
I'm have a lot of trouble with operators in variables.
e.g. _global.howmany = firstamount + secondamount +third amount
I always get the answer NaN
Does anyone know of a tutorial for naming variables and using operators (+ - x /) within them?
Thanks a lot in advance
[F8] Problems With Operators
Hi I have troubles with a multiplication i´m using an input text and i want to multiply the value of that input text for 7 and display the result in a dinamyc text, but the result is Nan instead of a number, why??
this is the code that i´m using
on (release) {
kmx = Number(km)* 7;
nextFrame();
}
kmx <--- dinamyc text
km<--- input text
thank you
E4X Access Operators.
I've got a feeling that I've completely misunderstood what E4X does. After reading the chapter in Flash AS3 Programming it looks like you do
anElement.someChild.(@id="specificId") to access a specific element.
However if I have this
<mx:XML id="testXML" >
<stuff>
<item id="one" data="data one" />
<item id="two" data="data two" />
<item id="three" data="data three" />
<item id="four" data="data four" />
</stuff>
</mx:XML>
And then I do this :
Alert.show(testXML.item.(@id='three').toXMLString( ), 'ah-ha');
What I see is this :
<item id="three" data="data one"/>
<item id="three" data="data two"/>
<item id="three" data="data three"/>
<item id="three" data="data four"/>
So the expression 'testXML.item.(@id='three')' has not selected an item based on it's id - which is what I was expecting - instead it's edited all items.
Can anyone point me in the direction of an explanation?
Custom Operators
I was wondering if there was a way to make custom operators in Flash. I'm trying to make a function that will add the x and y coordinates of two vectors.
va=[x1,y1]
vb=[x2,y2]
vc=va+vb=[x1+x2,y1+y2]
Code:
function Vector(x, y)
{
this.x = x;
this.y = y;
}
Vector.prototype.plus = function(v2)
{
this.x += v2.x;
this.y += v2.y;
}
var green=0x00CC00;
var black=0x000000;
var thickness=.5;
//Draws a line from vector a to vector b
function DrawLine(va,vb)
{
var Line:MovieClip = this.createEmptyMovieClip("Line",getNextHighestDepth());
Line.lineStyle(thickness,colour,100);
Line.moveTo(va.x,va.y);
Line.lineTo(vb.x,vb.y);
}
var va = new Vector(10,40);
var vb = new Vector(60,60);
var vc = new Vector(60,60);
vc.plus(va); // i would rather be able to use vc=va+vb;
trace("va=("+va.x+","+va.y+")");
trace("vb=("+vb.x+","+vb.y+")");
trace("vc=("+vc.x+","+vc.y+")");
var colour = black;
DrawLine(va,vb);
var colour = green;
DrawLine(vb,vc);
Once I figure this out I'll make a vector manipulation class and I can continue with my work.
Any help would be much appreciated!
Using Variables And Operators
I'm trying to dynamicly load multiple images to a Movie Clip on the stage. Where I am having trouble, is when I position different sized images one under another.
What I have done is, assign a variable for the position for the _y of the next image.
eg. var spacing:Number = 0;
Since I'm loading the images from a XML file, I've included the height for each image aswell. This is where I am having trouble
eg. spacing += myxml.childNodes[i].childNodes; OR
spacing = spacing + myxml.childNodes[i].childNodes;
trace(spacing);
Say for example, the image I am loading is 400px high, 'spacing' then appears to be 0400 and not 400. After I load the second image, which is 500px high, spacing appears to be 0400500 and not 900.
Any help is appreciated, Thank you.
irok
Working With E4X Operators
I'm trying to pick out the full "player" profile (xml..profilename) information about the player when the name matches eventPlayer - but all I am getting is "True" or "False" - What am I doing wrong?
ActionScript Code:
XML Structure:<?xml version="1.0" encoding="ISO-8859-15"?><map><player_profiles><profile quote=""> <xpos></xpos> <ypos></ypos> <profilename></profilename> <profilelocation></profilelocation> <headline></headline> <article></article> <results></results> <thumb></thumb> <image></image> <flag></flag></profile></player_profiles><eventsTitle> <eventsTitleName> <name></name> <event> <name></name> <xpos></xpos> <ypos></ypos> <players> <player></player> <player></player> <player></player> <player></player> </players> <tab></tab> <tab></tab> <tabDetails></tabDetails> <tabDetails></tabDetails> <flag></flag> </event> </eventsTitleName> </eventsTitle></map>
ActionScript Code:
function testButtonClick(event:MouseEvent) {
for (var i:uint=0; i<xmlList.eventsTitleName.event.length(); i++) {
for (var p:uint=0; p<xmlList.eventsTitleName.event[i].players.*.length(); p++) {
eventPlayer = xmlList.eventsTitleName.event[i].players.player[p];
for (var j:uint=0; j<xml..profilename.*.length(); j++) {
trace(xml..profilename[j].(name == eventPlayer));
}
}
trace("========");
}
}
Dependancy Using =| Operators
Hi All,
I have created a fruit/slot machine using actionscript.
On there are wild cards as will as typical win lines.
To check for a win I have the following code
} else if (leftReelResult=='melon'|'wildCard'&middleReelResult=='melon'|'wildCard'&rightReelResult=='melon'|'wildCard') {
trace('winner');
}
If You spin 3 x Melon the win is fine. If you spin wildCard x Melon x Melon the win is fine.
If however you spin:
melon x wildCard x melon or
melon x melon x wildCard
The win function is not called.
Can anybody help me to get the right code in here?
Big Thanks,
Dabush.
Operators Are Reversing Their Function
In writing any simple 'if than' statement my operator is acting in the reverse of what it is supposed to.
The following code comes out true when the cursor IS in the designated area and it certanly should not be true. Why is this happening?
// determin the location of mouse
x_pos = _root.grid._xmouse;
y_pos = _root.grid._ymouse;
// Make grid come on then mouse is over box
gridon = 0;
if (x_pos>=0) {
gridon = gridon+1;
}
if (x_pos<=580) {
gridon = gridon+1;
}
if (y_pos>=0) {
gridon = gridon+1;
}
if (y_pos<=126) {
gridon = gridon+1;
}
if (gridon != 4) {
tellTarget ("_root.grid") {
gotoAndPlay ("start on");
}
}
Math Operators In Expressions
How can I make a math operator, such as a plus sign (+) appear within an expression?
For instance, I have assigned random values for variables a, b, and c. Now I want variable d to appear as a math problem WITH the plus sign rather than evaluating it, so that it looks like:
d = (random value of a)+(random value of b)+(random value of c)
I welcome your suggestions!
Thanks,
Ashley
Left Side Operators
Okay, I know that in Flash 5 the following was okay:
eval("/:var1" add "/:var2") = /:varWhatever;
But in MX I get the error:
Left side of assignment operator must be variable or property.
I've never read anything about remedying this. Any suggestions? I'm sure it's something stupidly simple
Unary Operators Within Arrays
What is the simplest way to have the following expression (embedded in the array) solved: [4, "+", 5, "-", 6, "/", 9]
I am working on a genetic algortihm problem, and I need to be able to calculate the vlalue of equations that get built in the arrays. I've obviously tried parsing the literals to integers, but I can't do that with the operators, which seem to stay concatenators outside of the array, even when surounded by ints.
For example, in the array above, if I try to solve for the first 3 items:
myArray(parseInt[0]) + myArray[1] + myArray(parseInt[2]), I get:
4+5
Why doesn' t the operator add instead of concatenate, since the data types on either side are ints?
I would rather not have to write numerous operator detection functions to do the calculations.
Thanks,
Ira
Mathematical Operators... GRRR
i'm designing a children's maths game that basically centres around "if" statements and playing a certain .swf file dependant on the player's answer. my problem is that i need to play a certain .swf if the player's answer is wrong by 10 or more and i can't get the syntax right. confused? here it is
on(release){
if (_root.yourAnswer == _root.answer+10 ||
_root.yourAnswer == _root.answer-10 ||
_root.yourAnswer == _root.answer<-10 ||
_root.yourAnswer == _root.answer<+10) {
(loadMovie("gutterball.swf", "_root.checkMat"));
the 's are where i run into problems. how do i get it to play that .swf if the answer is wrong by 10 or more?
Switch Statements And && Operators
Hey, just updating this code that I am using which requires two variables to be equal to something that is set at runtime. Previously I was using:
Quote:
if (variableA=="person1" && variableB=="random"){
authentication()
} else if (variableA=="person2" && variableB=="testing"){
authentication()
}
The only difference is that I have about 15 else ifs.
Anyway, I decided that I want to use a switch statement, and can't get the and operators to work.
Basically what I want to achieve is to have a switch statement that requires two variables to be something, then activate a function if they are equal.
Cheers
P.S. any help will be much appreciated
Mathematical Operators Grrrrr...
i'm designing a children's maths game that basically centres around "if" statements and playing a certain .swf file dependant on the player's answer. my problem is that i need to play a certain .swf if the player's answer is wrong by 10 or more and i can't get the syntax right. confused? here it is
on(release){
if (_root.yourAnswer == _root.answer+10 ||
_root.yourAnswer == _root.answer-10 ||
_root.yourAnswer == _root.answer<-10 ||
_root.yourAnswer == _root.answer<+10) {
(loadMovie("gutterball.swf", "_root.checkMat"));
the 's are where i run into problems. how do i get it to play that .swf if the answer is wrong by 10 or more?
Integrating Variables Into Operators
hi all!
could anyone give me a hint on how the syntax for the following task should look like?
(timeline-position equals number of the song to be loaded, but I don't know how to integrate the previously read variable into the following command...)
trigger = _root._currentframe;
_global.Behaviors.Sound.song"trigger".mp3.start(0, 1);
doesn't seem to work...
thanx in advance. el que...
Insert Spaces Around Operators
I'm using Flash 9, CS3, on a Mac. In my preferences, under Auto Format, I have "insert spaces around operators" checked, but when I press Auto Format in the ActionScript window it doesn't work. Is there a work around?
Thanks!
Comparison Operators - Wildcard?
Hey Folks,
I am working on some search functionality, and want to be able to create a statement that will compare a string to see if it is included in a larger one. For instance, the user could search for "Bread" and I would want the results to include ["Bread Pudding","Wheat Bread","Cornbread"]. Something like that is proving tough for me,but I bet there is a magic piece of knowledge that I am not finding. Anyone got it?
Using Operators (<=) To Determine Score
I'm having trouble with this logic. I have a variable on Frame 1 _global.myVar=0 With each successful answer that value increases by 1. At the end I need to evaluate the score and send to a movie clip that will play a message related to their success in the quiz.
What is wrong with my code below:
if (_global.myVar= (<=3)){
tellTarget("/message") {
gotoAndPlay('poor')
}
if (_global.myVar= (>=4<7)){
tellTarget("/message") {
gotoAndPlay('good')
}
if (_global.myVar=(>=7)){
tellTarget("/message") {
gotoAndPlay('excellent')
}
Text File Containing Operators What The Right Syntax
hello everybody,
i need to write some arithematic in a text file that is loaded but the swf cant read ( + % x ) it only reads ( - )has anyone an idea how can i write these operators so that the swf can read it right.
Using Operators To Evaluate Dynamic Variables
I'm building a Learning Management System that includes Flash objects that pass variables back and forth to a mySQL dB.
One of the data pieces I'm passing/getting is a course completion number that is created by the triggering of a function that adds variables set as the user goes through the LMS course (hereafter the aggregate).
Everything works well and I'm getting data back and forth to the dB without any problems. My problem is this:
I need to tell the course completion variable to post the higher of the number retrieved from the dB or the aggregate number created by the function. So if the number retrieved from the dB is higher or the same as the aggregate generated number, the retrieved number is retained. If the aggregate number is higher than the retrieved number, the aggregate number is posted to the dB. The functions are triggered by the button that posts the data to the dB.
Whew! So here is the Actionscript:
//Create the comparison variable by adding the aggregate variables
function addUp() {
percent2comp = co1mp+co2mp+co3mp+co4mp+co5mp+co6mp;
}
//Compare the aggregate variable to the variable set by the dB
function comPare() {
if (percent2comp >= percent_comp) {
percent_comp = percent2comp;
} else {
percent_comp = percent_comp;
}
}
This returns the correct result when the value of the aggregate is higher, but returns the lower value to the dB when the aggregate is lower.
Can anyone troubleshoot this with me?
Thanks
New To FlashAS, Comparison Operators Don't Work As I'm Used To
Hello all
My first post!
I have some experience of Lingo and other scripting languages.
I recently got FlashMX 2004 / 7.0.1, which I'll be using to make interactive demostrations of interface concepts.
I've come across ActionScript weirdness that doesn't comply with my understanding of logic.
Example, I have the following code in a script that converts numbers to strings (0 to "0.0", 1.1 to "1.1", 9 to "9.0" etc.):
if (cvalue <1) {
// less than 1, add zeroes to front
numastext = "0." + numastext;
}
Now, in actionscript, if cvalue IS 1 the above code within the if{} is executed. How the hell is that possible ? If cvalue==1, why is code within condition cvalue <1 executed ?
Apparently I'm missing something major here, it's definitely something I don't understand.
Quick Question Re: Operators And If Statements
just need a little help.
i want to compare 10 numeric values, and assign them new variable names in ascending order.
what it the easiest way to do this...?
not like this i assume
ActionScript Code:
if(gigDat1 < gigDat2 && gigDat2 < gigDat3 && gigDat3...){
gigOrd1 = gigDat1}
else (if gigDat...
|