ActionScript 3.0 :: Scientific Notation In Conditionals

Nov 16, 2010

I have the following: ActionScript Code: if ((player.charVelocity < 9.0180945396304027e-26 && player.charVelocity > -9.0180945396304027e-26)) it seems to be firing as soon as charVelocity gets between 1 and -1. Am I writing that correctly? I assume it would work as I copied the syntax it was outputting for the variable value (which is set to 'int')

View 5 Replies


Similar Posts:


ActionScript 2.0 :: Convert Decimal Number To Scientific Notation?

Jul 21, 2010

I've got a calculator that i created in as2 that converts different units of measurement. However, right now it always converts the numbers into a decimal number like 0.33333333 or 450.72. How in the world would i convert these decimal numbers to scientific notation? For example, say i have a number: 12,700. Expressed in scientific notation, this would be 1.27x10^4.I hope there is an easy way to make flash convert to such a number system? I know its easy to round numbers in decimal, but have never worked with scientific notation before.

View 9 Replies

ActionScript 2.0 :: Round To Specific Decimals With Scientific Numbers?

Oct 2, 2010

This one seems though, as there isn't even a regular "round-to-specific-decimal" function.. (I know the work around for that though)[code]...

View 2 Replies

'If' And 'Else If' Conditionals Not Running Properly?

Jun 11, 2009

I've got a function which looks at movieclips (ball#_mc) which have been placed in a target zone (_ballPlaced[#] boolean). It then decides where to go on each movieclip timeline depending on which other balls have been placed in a target zone.Only the first condition is ever met, i.e. when all the balls are in a zone, they jump to their correct places in their timelines....however, it doesn't work for any of the other 'else if' conditions?
 
Here's my code...
 
// function to determine which video to play for each ballprivate function playVideo(event:Event):void            {                if (ball0_mc._ballPlaced[0] && ball1_mc._ballPlaced[1] && ball2_mc._ballPlaced[2] && ball3_mc._ballPlaced[3])                {                    ball0_mc.gotoAndPlay("BluYelRedGre");                   

[code]....

View 2 Replies

Boolean - Using Visibility With Conditionals

Apr 30, 2010

Is there a better way to do use a use a boolean with visible? I'm setting up animations that have conditions for visibility, and I don't want to use something that performs poorly. This animation blinks 30 times and stops. It works without error, but takes a moment to load. I would like to learn other ways of using visibility with conditionals.

This is what I used 'waits before playing'
if(condition=5){
box.visible = !box.visible;
This works fine 'no pause'
if(condition<6){
box.visible = !box.visible;
[Code] .....

View 1 Replies

Actionscript 3 :: Difference Between Conditionals?

Nov 9, 2010

Just wanted to know if someone can explain the difference between these two conditionals:

if ( !object )

if ( object == null )

where object is an instance of a user-defined class.I'm sure that these two cannot be used in an interchangeable manner, or are they?

View 3 Replies

Xml :: Flex Using XML Dot Notation String?

Mar 8, 2012

In the following example the first trace gives me the xml data at the node, but the second trace does not. This is AS3. How would I use a variable to do the same as inline dot notation?

var x:String = "animXML.home.version";
trace(animXML.home.version); // this works
trace([x]); // this does not

View 1 Replies

ActionScript 3.0 :: IF And ELSE Conditionals Not Working?

Jun 30, 2009

I've got a function which uses a 'hitTestObject' test if two moive clips are touching each other. A FOR loop has been used to run through all the zones, to check if they've been touched. Within this FOR loop is an IF condition which then locks the ball to that particular zone if the ball and zone are touching. The ELSE statement sends the ball back to a random place on the stage if they're not touching.

However, the IF statement seems to be getting bypassed. Whenever a ball is dragged over a zone and the mouse is released, rather than locking to that zone's x and y positions, it gets placed randomly on the stage...i.e. the ELSE statement is being activated all the time?! I've commented out the ELSE condition and the IF works fine on it's own, it's just when the ELSE condition is included the IF is bypassed.

ActionScript Code:
private function zoneFill(event:MouseEvent):void{
for (var i:uint = 0; i<=8; i++){
var index:Number = event.target.name.substring(5,6);
if(event.target.hitTestObject(zone[i]) && zoneFull[i] == false && event.target._ballPlaced[index]== false){
[Code] .....

View 1 Replies

ActionScript 3.0 :: Using Conditionals With XML In Flash?

Aug 28, 2009

I have an xml file that currently contains the following parameters:

<navigation>
<node title="Portfolio 1">
<picture>
<thumb></thumb>
<img></img>

[code]...

View 2 Replies

IDE :: Conditionals Crontrolled By Date

Nov 23, 2009

I need to load a movie only if it's a specific calendar date.

i.e. if date = (date) loadmovie

View 14 Replies

ActionScript 3.0 :: Arrays And Conditionals Not Working?

Feb 8, 2010

I'm working with CS4 and AS3 using timeline coding. I have three sets of movie clips in three different arrays. The idea is to have topArray and downArray movies make zeroArray movies visible. For instance, if topArray[0] and downArray[0] are clicked, then r0_0 becomes visible. PROBLEM: r0_0 becomes visible when EITHER topArray or downArray is clicked. How to make r0_0 wait until BOTH top and downArray movies are clicked?

[Code]...

View 5 Replies

Actionscript 3 :: Object Notation For Variable

Dec 3, 2011

I have some variables in the format: var like6Y:Number = 50; Later I am dynamically setting some: num=6; Then I am trying to use that num to get the variable like6Y: like+6+Y I know that is totally wrong but I seem to remember you could use some kind of object notation to accomplish this: ["like"+num+"Y"] Or something along those lines. But I can't remember how to do it.

View 3 Replies

ActionScript 3.0 :: Conditionals Not Responding Properly?

Feb 9, 2010

I'm working with CS4 and AS3 using timeline coding. I have three sets of movie clips in three different arrays. The idea is to have topArray and downArray movies make zeroArray movies visible. For instance, if topArray[0] and downArray[0] are clicked, then r0_0 becomes visible. PROBLEM: r0_0 becomes visible when EITHER topArray or downArray is clicked. How to make r0_0 wait until BOTH top and downArray movies are clicked?

ActionScript Code:
//
//movie clips holdings results -- all invisible
var zeroRow:Array =[r0_0, r0_1, r0_2, r0_3, r0_4, r0_5, r0_6, r0_7, r0_8, r0_9, r0_10];
for (var a:int=0; a<zeroRow.length; a++) {zeroRow[a].visible=false}

[code]....

View 4 Replies

ActionScript 3.0 :: Find Bearing Without Using Conditionals

Nov 29, 2011

I want to calculate the angle a line makes with the positive x-axis in a clockwise direction. It's a lot like a bearing except instead of North, I want the angle it makes with positive x-axis. The image illustrates what I'm after.

Below is the code I wrote to achieve this. It works fine but I am just wondering if there's a way to reduce all these if statements.

ActionScript Code:
/**
* @return Bearing, in radians, of <code>p2</code> from <code>p1</code>
*/

[Code]....

View 2 Replies

ActionScript 2.0 :: Using Array Notation And This Keyword

Feb 19, 2006

I am trying to create a number of movie clips in my main movie but I don't seem to be able to access these movies using array notation and the 'this' keyword. Here's some example code in a main timeline.
var i=0;
createEmptyMovieClip("clip"+1,0);
trace(this["clip"+i]);
////undefined - why?????
var clip=createEmptyMovieClip("clip_holder",1);
clip.createEmptyMovieClip("clip"+i,0);
trace(clip_holder["clip"+i]);
/////_level0.clip_holder.clip0.
This is ok. What's wrong with this["clip"+i] ?

View 1 Replies

Actionscript 3.0 :: Order Of Evaluation Of Conditionals In Flex?

Jan 25, 2010

var btn:Button;
if(btn != null && btn.label != '') {
mx.controls.Alert.show("d");
}

In the above if clause, is it guaranteed that the first condition(btn != null) will be evaluated before the second condition?

View 2 Replies

ActionScript 2.0 :: Variable-Bracket Notation-Loops?

Mar 12, 2007

I have taken a bottle of Excedrin due to the headache I've developed from this problem I am having. I have some variables:

[AS]
var snd1:Sound = new Sound(this);
var snd2:Sound = new Sound(this);

[code].....

View 1 Replies

ActionScript 2.0 :: Shorter Notation For Zillion OnRollOver's?

Oct 5, 2004

I have 10 or 100 or 1000 mc's on stage that do exactly the same on an onRollOver event and on an onRollOut event, what's the easiest way of writing this ? let's assume that the mc's are called mc1 to mc100, could it be done with an array and/or for statement ? Cause I'm used to old fashioned coding, I'm used not to try to cut corners So it kind of restricts my thinking a bit at times. So, do I need to start with an onRollOver event handler for each button in order to make Flash notice the onRollOver event for each button ?

View 1 Replies

ActionScript 2.0 :: Dynamic MovieClip Referencing Using Array Notation

Feb 23, 2009

I know that a dynamic mc can be referenced using array notation
viz: myArray['someName'+i]
My question is ... can mcs that have been placed on the stage and given instance names be referenced in some similar way? If I have placed 10 mc's with different instance names eg mg1, mg2, mg3 etc, can I reference them using array referencing?

View 6 Replies

ActionScript 3.0 :: Object Literal Notation For A Custom Class?

Feb 10, 2010

I've created a custom class to represent a monster in a game. The class definition has "public class Monster extends Object". I'd like to know if there's a way to initialize the object using object literal notation. For example, this works ok:

[Code]...

I get this error: "Implicit coercion of a value with static type Object to a possibly unrelated type Monster." Is there a way to do this? I'd rather NOT have to call the Monster's class initializer each time, because in the actual code there are a lot more variables in the monster class than just those three, and it's kinda unwieldy to pass a dozen long strings into the new() function.

View 3 Replies

ActionScript 3.0 :: Switch Conditionals - Error #1069: Property Level Not Found On Flash?

Nov 11, 2011

i'm working on a homework assignment in where we created a match game.  It's up to me to figure out how to tell the action script which difficulty the user play the game at.  There are 3 buttons easy, mediym, hard.  Each one lays out an increased number of cards say 4 for easy 8 for medium etc. 
 
we are supposed to use the switch conditional to do this.My problem is how does the switch know which button was clicked?here is the code so far, it is only set up for the easy at the moment.It works fine until I tried to set up the switch.
 
package {
import flash.display.MovieClip;
import flash.display.Sprite;[code]....
 
when I click the easy button in the swf file I get this message.
 
ReferenceError: Error #1069: Property level not found on flash.display.SimpleButton and there is no default value.
          at Match/onClickButton()

View 3 Replies

ActionScript 2.0 :: Centralize Code In All Movies Using Dot Notation Instead Of Spreading Code All Over The Place?

Jul 10, 2003

I have attached a simple test fla.I am trying to centralize my code in all my movies using dot notation instead of spreading my code all over the place. It never works, I must be doing something wrong.The test .fla has a movieclip with a timeline animation. I used the linkage identifier to name it 'reload' AND named the instance 'reload'.

_root.reload.onRollOver = function() {
this.gotoAndPlay(2);
}

The pointer doesnt even change to a hand.

View 4 Replies

ActionScript 3.0 :: Getting A Compiler Error On The "." But That Seems To Be The Defacto Vector Notation?

Apr 2, 2009

Is there any reason why Vector would not be supported in CS3?

I have the following line:
private var pageRequests:Vector.<PageRequest>;

I'm getting a compiler error on the "." but that seems to be the defacto Vector notation. If for some reason this isn't currently supported in my version of CS3, then does anyone know how I can update the actionscript library to allow it?

View 1 Replies

ActionScript 3.0 :: Always Skips The First Two CurrentFrame If Conditionals And Runs The Last CurrentFrame If Conditional

Mar 5, 2012

I have checked over and over again. But when I run it, it always skips the first two currentFrame if conditionals and runs the last currentFrame if conditional. I have this code in another file and it works perfectly...

[Code]....

View 2 Replies

ActionScript 3.0 :: Flash FXON (Flash XML Object Notation) Project

Apr 16, 2011

I just started an open source project @ Google Code. I came up with this simple notation for a recent project. I have since used it on several projects and am happy to share it with anyone else who might benefit. I could also use a hand with the documentation and also features if anyone is interested in helping out. Take a look and feel free to provide feedback. [URL]

View 11 Replies

Flex :: Filtrate XMLList Using ".." Notation

Jun 22, 2011

There is something I couldn't solve: when I search a specific node in a XMLList containing several level of hierarchy, filter never search in the top parent node. For example, if I have a tree like this:

[Code]...

View 1 Replies

Actionscript 3 :: Getting The Value Of A Property Within Another Property Via Square Bracket Notation

Nov 29, 2011

I have a class Inhabitant with a property skin which is of type DisplayObject.

Within Inhabitant I need to access the x and y properties of skin using this method:

this["someProperty"];
Rather than:
this.someProperty;

This is fine with properties defined within Inhabitant but I'm not sure how I could do this for a property of skin. This obviously doesn't work but it might give you an idea of what I'm trying to do:

this["skin.x"];

The reason behind requiring this notation is that I have a function which I can parse a String though that will represent a property:

public function addTokenable(property:String):void
{
if(!isTokenable(property))
_tokenables[property] = true;
}

And then a related getter that will return a representation of this instance of Inhabitant as a String:

public function get token():String
{
_token = "class:" + getQualifiedClassName(this).split("::").join(".");

[Code]....

View 1 Replies

Flex :: Throws A Warning,unlike Java, Which Throws An Error "Assignment In Conditionals"?

Aug 6, 2009

If I use an Assignment within conditional, for e.g.
if(userType='admin')

Flex throws a warning,unlike Java, which throws an error.Why should Flex be doing this, despite being one of the newest languages? 1100: Assignment within conditional. Did you mean == instead of =?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved