Javascript :: Nested While Loops And Duplicate Results?

Jun 6, 2011

The code is supposed to receive one system id and then scan around that system in all directions, with each direction having its own length. It is like scanning a rectangle around that system where 9*9 = 81 systems.The code works very well; but the problem. I get 8 duplicate results and there is a complete row missing from the results. The one just above the middle row. I think the problem is in the topsystem integer but I don't know what is wrong with it.[code]if you watch the part of the code that has if statements. this part handle the edges.specially zero and 10k. about what i want to do. think about it like a 9*9 dots field in rectangular shape. has 9 rows and 9 columns. each dot has an id from 1 to 10k. the input is the id of the dot in the center of the field (column 5, row 5). as now i know this centeral dot id. i want to loop through the whole field to find the other dots ids using topsystem(the distance between the centeral dot to the upper edge).downsystem (the distance between central dot to the lower edge). leftsystem (the distance between central dot and left edge).rightsystem (the distance between central dot and right edge).the code is working fine but there is 8 missing ids that replaced by 8 duplicated ids.

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Using For Loops To Duplicate A MovieClip

Aug 24, 2010

Ive seen this for loop to duplicate a movieclip.Its somethin.g i like to understand its square brackets. when are square brackets used instead of the circular brackets.

for(i=1; i<5;i++){
_root["face"].duplicateMovieClip("face"+i,i++,face)
}

and i woud also like to know. i understand the first part. i = zero if i less than 5 add one.until 5 is made. which is reffering to the maintimeline.

1. is this refering main movie clip to be duplicated? ["face"]

2.In the final round brackets ("face"+i,i++,face) not sure n some of the meaning.

View 5 Replies

ActionScript 2.0 :: Create A Loop Which Generates A Single Series Of Sine Results Ranging From 0 To 1 Based On 100 Loops?

Jan 20, 2006

I'm trying to create a loop which generates a single series of sine results ranging from 0 to 1 based on 100 loops ( ie 0 ,0.011 ,0.1111........up to 1 in a single run)The results I want start at 0 and increment in a series up to 1 and then stop. I suppose this would be one half of a sine wave I have tried the following but it goes from 0 to 1 ,1 to 0 , 0 to 1 etc whereas I want a single straight run of 100 values from 0 to 1

I tried :

for(var i:Number=0;i<=100;i++){
trace((0.5*Math.sin(i)) + 0.5);
}

This does not work.

View 1 Replies

ActionScript 2.0 :: Why Nested Loops Necessary To Use

Aug 17, 2002

Why nested loops must be used. I have this code that I took from the Training from the source book:

v = 0;
i = -1;
while(++i < 2){
j = -1;
while(++j < 2){
[Code] .....

What I don't understand is why I have to have this to create two columns couldn't I just change the while (++i < 2){ to
while(++i < 4){ instead.

View 3 Replies

Actionscript 3 :: Can't Break Out Of Nested For Loops

Jan 12, 2010

I have the following function but despite using the break statement, it doesn't seem to be stopping after it finds a match in the array:

[Code]....

View 3 Replies

ActionScript 2.0 :: Nested Loops With XML Data?

Oct 19, 2005

I'm trying to build a musicians site. I'm populating menus, the musicians page, and some other stuff with XML. getting all the attributes (of the artists CD) for each artist. Here's one artist entry in my XML file:

Code:
<ARTISTS>
<ARTIST>
<NAME>AP.9 FED-X</NAME>

[Code]....

Yeah, I don't know how to handle several CDs for each artist. I can see I need a nested loop, but do I store those CD attributes in an array, or create a variable like some_mc["CDLIST"+j] ???

Then I gotta think about building the discography movieclip. I'll worry about that later. What I got working so far is at [URL]

View 5 Replies

ActionScript 3.0 :: Nested For Loops Optimization / Replacement

Mar 18, 2010

I have a program where I have around 100 LatLng (latitude longitude) points, and i have to get the largest distance between any 5 of them but you can only go forward (so if latlng_1 is the point number 5 latlng_2 can only be point number 6,7,8,....,100).
<-- skip the colored thing if its unclear
So I calculate the distance like this:

Code:
Select allfor(i=0;i<points_num;i++) {
for(j=i;j<........
// three more for loops
// and than calculate the distance between all five points and compare if it is larger than previous...

The problem is that the program stops responding for about 2 minutes to calculate this and I would like to know if there is anything I can do to calculate this thing faster? Yes I can reduce the point but than the thing I want to get is less accurate and even if I reduce the points I still want the calculation to be as fast as it can be.

View 2 Replies

ActionScript 2.0 :: Eval() Versus [] Use In Nested Loops?

Jan 23, 2008

why code snippet #1 works, but code snippet #2 doesn't? i thought the array operator would work in this case...

CODE SNIPPET #1:

Code:
for (i=0;i<products.length;i++)
{
// XML data code
for (j=0;j<prodItems.length;j++)

[code]....

View 3 Replies

Php :: Calling A Page With MySQL Query From Javascript Function Then Returning Results To Another Javascript Function

Jul 8, 2010

I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query

[Code]....

View 2 Replies

ActionScript 2.0 :: Duplicate Nested MCs Not Inheriting

Apr 30, 2005

I have one mc lets call this mc1 with 3 or 4 mcs nested inside of it. Now I have copied and pasted this mc and called it mc2. Now if I change something in any of the mcs inside mc 1, mc2 automatically gets the same changes and vice versa, any way to avoid this? So I can have the mc1 containing something different than mc2.

View 1 Replies

ActionScript 2.0 :: Duplicate Nested Mcs Not Inheriting?

Apr 30, 2005

i have one mc lets call this mc1 with 3 or 4 mcs nested inside of it now i have copied and pasted this mc and called it mc2.now if i change something in any of the mcs inside mc 1 mc2 autmatically gets the same changes and vice versa, any way to avoid this? i can have the mc1 containg something different than mc2

View 1 Replies

ActionScript 2.0 :: Duplicate Nested Movieclip And Swap?

Dec 14, 2011

is there a jsx script that I can use to duplicated a nested clip in my library along with all of the sub movieclips and relink them?

View 0 Replies

ActionScript 2.0 :: Duplicate A Nested Movie Clip And Then Placing It On Top / Root Level?

Feb 12, 2009

I'm sorry if this post breaks forum conventions, but I searched and didn't find a solution in past posts.

I'm writing a function that highlights components of the animation I've created.

It does this by creating a white box on top of the entire stage, tweening it's alpha value from 0 to 80, and creating a new instance of the movie clip to be highlighted on top of that white box.

I run into a problem when I need to highlight components that are movie clips nested within ones on the top/root level.

When I duplicate instances of nested movie clips, they just exist within the movie they were nested in.

I want to pull those duplicated, nested movie clips into the root area so it rests on top of that white box I just mentioned. How do I take a nested movie clip and pull it out of it's parent onto the top/root level?

View 1 Replies

Javascript :: Algorithm Does An HTML SELECT Element Uses To Show Results As Type?

Jan 21, 2010

In most browsers, when you have one in focus and you type something, the combobox will try to find the value within its options and show the closest one. I was wondering what kind of algorithm is used for that.I don't think its Levenshtein or similar since it only works with the beginning of the string.I'm thinking that it works by keeping a buffer of what has been written, and tries to find a string starting with that... if it doesn't find anything, it clears the buffer, and searches a string beginning with the last character pressed.I already prototyped this, and it works quite ok, with one caveat... In HTML, when you repeatedly press the same key, it will rotate between all options starting with that character.

View 4 Replies

JavaScript :: Any Way To Duplicate Flash Gallery?

Aug 12, 2010

Is there already a plugin for jquery to re-create this: [URL]

View 2 Replies

Javascript :: Duplicate Flex Object In HTML Without Re-Initializing?

Oct 16, 2009

I am creating a flash object that does some heavy image lifting. What I am looking to do is load many flash objects onto the same page to take an image, modify it, and display it within the flash object.The problem I am running into is that when I try to add 100 flex objects to the page, the browser freezes as it tries to re-load/initialize each instance.Once they are all loaded, the processing of the images goes by quick.Does anyone know how to duplicate the flash piece without having to reload everything?

View 2 Replies

Javascript :: Nested Tags Work In E4X?

Jun 24, 2010

Suppose I have the following XML:var foo:XML = <root><a>this is a <b>special</b> case</a></root>

Is there any way to detect the position of <b> relative to the contents of <a> without a custom subparser?

View 1 Replies

ActionScript 2.0 :: When Click The Letter Movieclip It Does Create The Duplicate As It Should And It Starts To Drag The Duplicate Mc

Mar 20, 2010

My problem is that when I click the letter movieclip it does create the duplicate as it should and it starts to drag the duplicate mc. However, when I release the clip it doesn't stop dragging? I realized that if I put onMouseUP event instead of onRelease it actually does stop dragging when I release the mouse. I would, however not like to use the onMouseUP event if possible.

[Code]...

View 2 Replies

Actionscript 3 :: Duplicate AddEventListener Calls Create Duplicate Listener Entries?

May 4, 2010

If I have an object that calls

addEventListener(Event.ENTER_FRAME, update);
addEventListener(Event.ENTER_FRAME, update);

will that add 2 listeners?

View 2 Replies

Duplicate Symbol - Edit The Duplicate It Also Modifies What Is In The Original

Sep 26, 2000

I am having problems dupliating a movie clip. I can make a duplicate from an original but when I edit the duplicate it also modifies what is in the original. (I am just changing the text, thats the only difference between the 2) How come it effects both clips when I only change one?

View 6 Replies

ActionScript 2.0 :: Setting The Depth Of A Nested Object Higher Than That Of A Non-nested Object?

Jun 24, 2005

As the title says, i would like to have an object which is nested beneath another objects depth set higher than that of one the is NOT nested. Is this possible if so how, may be real easy and im just over-looking it but

View 1 Replies

IDE :: Can't Get Results In Quiz

Mar 10, 2007

i made a quiz in flash using actionscript:

At the end I have to sum the answers and show the result to the user but I can't get it.

Here is the code (I'm kind of new to actionscript, sorry if the code it's too long):

Code:
var p1=0;
var p2=0;
var p3=0;

[Code].....

View 5 Replies

Javascript :: Javascript - Target Multiple Objects With A Single Operation Using ECMAScript's `with` Statement?

May 2, 2011

The following doesn't work (although it gives no explicit error), but why not?nd... Is there really no way around it, strictly using the with statement? Forget using for / foreach.

with (object1, object2) {
attribute = value;
method();
}

Why the code above gives no syntax error, doesn't work but is accepted by with?If it's possible, how could we change multiple objects with same attribute using with?

var object1 = { attribute: 3 };
var object2 = { attribute: 2, method: function() { alert('blah'); } };
var object3 = { method: function() {alert('bleh'); } };

[code]....

View 2 Replies

Javascript :: Insert Javascript Functions To An HTML Document From The Child Flash Swf File?

Jan 29, 2012

I need to execute some javascript string code from flash swf file using actionscript 3.
I read that it could be done by passing the javascript code to the parent html document , using externalinterface.call function. Then I assume it will be faster if I can declare functions in the javascript code in the HTML document in the first use of externalinterface.call funtion ; if flash code calls the javascript code repeatedly. So let me ask you how to do that. For details , any javascript to be loaded is unknown in design time and I can not prepare a javascript file to be loaded.

View 2 Replies

Javascript :: Unable To Communicate With Javascript From Flex After Dymanically Loading A Swf?

Aug 1, 2009

for some reason, whenever I dynamically load a swf on a $(document).ready() by writing to a div, I am unable to make javascript calls to the browser. Specifically, all calls to the browser return "null". This does not occur when embedding the swf normally on the page load, but I would like to prevent loading of the swf until a specified point in time.

What the heck is going on here? Is there something special about dynamically embedding a swf that prevents the swf from talking to the browser? The methods ARE called (I've proven such by showing alerts), but all return values to any function, regardless of type returned, shows as null when it gets to flash.

View 3 Replies

Javascript :: Passing File Paths From Flash To JavaScript For Upload?

Sep 29, 2010

Is it possible to pass file names from a running Flash application, which only purpose is to enable multiple-file-selection, to a JavaScript application which handles upload of all files to the server?I have examined various Flash upload solutions (like SWFUpload, Uploadify, etc.) and none of them meets my needs. I want an easy to implement solution (like Uploadify) which also lets me specify various parts of the HTTP request.

The reason I need this is because my upload form uses session cookies (for user authentication) and an CSRF token both passed to the server when uploading files.Is it technically possible to pass filenames (+ paths) to a JavaScript application which then handles the upload?

View 1 Replies

Javascript 3 :: Can A JavaScript Function Detect Which Flash DOM Object Called It

May 20, 2011

Here's the challenge: I have a Flash movie which will be embedded in a page using an unknown DOM ID that I want to be able to identify/store for callback in a JS function. My ideal user flow would be: User clicks button in Flash. Flash pauses any animations / video / sounds / etc. Flash calls an injected JS function to display a page-covering overlay experience. When user closes overlay experience, a callback method on the Flash object is called. Flash resumes playback.

The problem is, when AS3 uses the ExternalInterface.call("functionName", args...) method, there doesn't seem to be a DOM event triggered, and thus it is impossible to tell which object called a JS function, so having a "registerMe()" function doesn't seem to work. Basically, the injected JS function has no way to determine which DOM object to call, because the ID of the Flash object is unknown.

[Code]...

View 3 Replies

Javascript :: Call An External Javascript On Frame Action/change?

Aug 26, 2011

i have a flash movie with 2 frames. and i would like to call an external javasscript function on frame action.

[Code]...

View 2 Replies

Javascript :: Flash - Call A Javascript Function From An Embedded .swf File

Apr 16, 2009

I'd like to call a javascript function from an embedded .swf file. Specifically, I'd like to call a function in one of my externally linked javascript files from within: function loadTrack(){

[Code]...

which is in an .as file which I assume somehow becomes the swf file. How would I go about this and 're-compile' the .as file?

View 3 Replies

Javascript :: Cross-domain Browsing Javascript, Silverlight Flash?

Oct 2, 2011

I'm trying to write a web application that searches google and then downloads the result sites and parses them.The search has to be done on the client side. Without implementing a server side proxy.Can this be done using javascript/sliverlight/flash?

View 1 Replies







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