ActionScript 1/2 :: Find The Square Root Of A Number/variable?
Mar 4, 2010I have a number inside a variable. How do I trace the square root of the variable? for example: var xxyy = 57;
I want to trace the square root of 57;
I have a number inside a variable. How do I trace the square root of the variable? for example: var xxyy = 57;
I want to trace the square root of 57;
How can i find the square of a number?
View 5 RepliesId like to set a grid based on the closest square. I know in my mind that 3x3=9 and i know that if i have 10 items, well 9 isnt enough, but 12 is....
View 2 RepliesIs there a simple way of pressing a button on a flash calculator to calculate the square root (sqrt)? I cant find anything about it. for example
Code:
// Tangent of the angle in degree
function Dotan () {
if (display == 90) {
display = "Infinity";
[code]....
I'm starting to write services for AMFPHP and found this example that works
Code: Select all<?php
class HelloWorld
{
public function say($sMessage)
[Code]....
The only things i can think of is something like thistrace(Math.sqrt(4) is int)is there any other way?
View 9 Repliesdoes anyone know if there is a way to display the square root symbol in a text box flash 8 using actionscript? For instance I just want to display the square root of 4 just the problem not the actual calculated value.
View 1 Repliesi have a grid:
0 - 1 - 2 - 3
4 - 5 - 6 - 7
8 - 9 - 10 - 11
12 - 13 - 14 - 15
(but will be more rows...)how can i find out programmatically if a random number (within the range of the numbers) is equal to the far right number: 3,7,11,15...?
I'm trying to make a basic flash calculator except it only has to be able to square the number provided by the user, I have followed many tutorials but I keep getting the NaN as the output. Here is the actionscript:
import flash.events.MouseEvent;
square_btn.addEventListener(MouseEvent.CLICK,
squareClick);
[code]...
I also need to have Input box and Error Messages & Highlighted Input Box.
I'm trying to break up a square or rectangle into a large number of randomly sized squares or rectangles so that none are overlapping.How to fill a square with smaller squares/rectangles?The solution seems to be either through bin packing or some sort of tree map.But what I'm looking for is the actual algorithm in Java, Javacript , actionscript or even C.
View 3 RepliesI'm trying to do that trick where you make a variable name with square brackets. I think I don't fully understand what I'm doing though...
Code:
var cursorDirection1:Point = pt.subtract(rootpos1);
var cursorDirection2:Point = pt.subtract(rootpos2);
var farShoulder:int = 1;//1 = left 2 = right
[Code]....
I'm trying to avoid having to do a conditional to choose between cursorDirection1 or cursorDirection2. My last line there isn't working, I'm not entirely sure why. Assuming farShoulder is 1, the code should be interpreted as
Code:
cursorDirection1.normalize(findNormVar(cursorDirection1));
but I'm getting errors about the input being undefined.
when creating a dynamic square with the api. 400 by 400. I am not sure why it wont draw the object
[Code]...
I have this game, and some levels have a moving square as the player, you move the square with your arrow keys.... I want to have an enemy square that chases the player square.... They only chased mario when you didn't look at them? Kinda like that...... but in this regards:
I only want the enemy square to chase the player square when the player square moves.... soo say the player square moves 5 pixels per movement (know how to do all that), I want the enemy square to move when the player square moves..... towards the player square at like 7 pixels per movement..... so eventually you won't be able to avoid the enemy square....
lets say that when you click on a button the variable number goes up 1 or 2 but it picks it randomly
how would i do it
[Code]...
I want to make a square grid of fixed side length but varying grid number using code.That is, the number of grids should be specified by the user (say 3*3) and after pressing a button, the stage should be broken into 3*3 grids.I don't want any code, just a method on how to do it. I have tried it by using simple loops but the method just fails for no reason I can figure.
View 5 RepliesI recently bought a new machine and tried to put my Flash 8 software onto it. The serial number was fine, but it requested the serial number of the software I upgraded from, which I no longer have (MX, I think it was. I threw it out ages ago thinking I didn't need it ). I can't even remember what email address my macromedia/adobe account was under, it might even be under an email address for a domain I no longer have.
I do still have the software installed on my old PC. Is there anyway I can find out the serial number of the MX I upgraded from off of the Flash 8 on there? Or it is a lost cause?
Im looking to be able to find a number (any number) within a text string, what i ultimately want to do is crop the number out of the string to just be left with a number value, the only problem is the string could be any length and the number doesnt necessarily start at any point from the last characterI have items on the stage named 'image0', 'textfield2', 'button500' etc, as you can see the prefix before the number isnt a fixed length so I couldnt use substr and set an index, and since the number could be any number i couldnt set the index as a certain value before the end of the string. (ie it might return '500' or 'ld2' or 'ge0' in the examples given before)
View 4 RepliesIs there a way to find how many child of movieclip inside a movieclip .. in AS2 just like in as3 there is a property called numOfChildren or something like that?
View 2 RepliesI just completed myXML.load(), now how do I determine how many "picture" nodes is in it.My XML looks like ...
Code:
<gallery>
<picture></picture>
[code].....
I want to take a string that contains numbers and search for a specific number within that string.
For example, my string is "0 1 3." I want to check to see if the number 3 appears within this string.
I need to check if a number is negative and if so, trace "true" and if not "false".
View 2 Repliesi have a gallery of images, 4 galleries actually. I have thumbnails that pop up for each gallery. I want to find out how to detect which thumbnail is being selected so i can load the appropriate image.
Code:
var picNum:Number
picLoad.load(new URLRequest(myXML.Gallery[galNum].Image[picNum].@picURL));
stage.addChild(picLoad);
[Code]...
I want to take a string that contains numbers and search for a specific number within that string. For example, my string is "0 1 3." I want to check to see if the number 3 appears within this string.
View 10 RepliesI brought a pre-built shopping cart and I'm trying to put some buttons in another MC but when I click them the cart don't update.
The original setup of the cart was:
The 'Add to cart' buttons are on the root and the cart was inside an MC also on the root.
Now I understand that it's not not working due to me moving the buttons into a MC.[code]...
I have a button in the frame 1 when i clicked it,it goes to the nextframe in nextframe i have movie clip named "circle". in frame 1 in action layer i have variable named "i" it has a number equal 20; now i'm in "circle" movieclip in the action layer i want to write a command for checking "i" if it's equal 20 the "circle" movieclip play but i can't find "i" how can i access to "i" variable in frame 1 ?
View 4 RepliesI need to trace the current level number that I am working on. So say I have 3 swf's loaded onto different levels (_level0, _level1, _level2, _level3), and each has a button, so when I press the button in level1, the number will trace 1, press button in level2, number will be 2, etc.
View 1 RepliesI recently purchased a macbook pro from eBay which had Flash CS4 already installed on it, but which didn't come with the original documentation or CDs that would have had the serial number. The seller said he would send along the appropriate numbers when he tracked them down, but he never got back to me again. I'd like to upgrade to Flash CS5 now, so is there any way I can find the serial number through the software itself? I've seen similar threads to this one elsewhere in the forums and the most promising answers have involved people locating truncated numbers in the software and asking Adobe to decrypt them. Unfortunately, I can't even find these truncated numbers...
View 2 RepliesI'm using the TouchEvent listener rather than the TransformGestureEvent listener because the TransformGestureEvent listener's built in gestures (particularly zoom) seem to be extremely slow and poorly thought out. So I'm dealing with raw touch data and I need to find the number of current touchpoints. Is there a method that returns the number of touchpoints currently on the screen?
View 1 RepliesWhat is the best way to find the closes value in a range...
for example i have an array with 0, 90, 180, 270, 360.And a number 46...
What is the best way to find 90 in the array?
I'm trying to work out a logic for a game (in Flash). In one part, given the following row:
_ _ * _ _ __ *
I need to find if all the spaces between the *'s are empty (Non-empty values other than * can occur in the row). This operation is done quite frequently. I was wondering if I could use bit representations of rows to achieve this, instead of looping through and checking the intermediate positions.
For a row _ _ * _ _ _ * represented as xx1xxx1 (x = 1 or 0), I could AND it with 0001110 so that if the answer is 0000000, the intermediate positions are empty.
The question here is, of course, how to find this second map (0001110 above) using bit operations (in Flash AS2)? (Map (1,4) -> 0110, (1,3) -> 0100 etc) Or is looping through the intermediate positions just the better choice?