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
Similar Posts:
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
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
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
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
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
Mar 30, 2010
We are currently looking at developing flash based applications (using Flex) in a web application. We are now leaning towards to use SVG rapheljs for developing this components. The questions are: Is still SVG platform is widely adopted by browsers (without any plug-ins) are at least down the line of 8-10 months, any adoption is expected by browsers? Cross-browser support is god for us. Is SVG can replace for a small time animation based programming instead of Flash
View 1 Replies
Jun 8, 2004
trying to load five images from an xml array randomly without replacement**without replacment - meaning i dont want to use the same random number in my array.all i need is the math for the actionscript
Code:
menuXml = new XML();
menuXml.ignoreWhite = true;
[code].....
View 4 Replies
Jun 8, 2004
trying to load five images from an xml array randomly without replacement*without replacment - meaning i dont want to use the same random number in my array.all i need is the math for the actionscript.[code]
View 4 Replies
May 31, 2009
I wish to replace my desktop replacement with a tablet PC I have visions of Cintique-like functionality yet portable majesty...
But the graphics cards on these machines are total crap. However, some graphics card models claim to steal memory from the RAM, so in theory if I soup up the RAM I have a really powerful graphics card?
Anybody out there author on a tablet PC? I'm running Flash CS3, and must make my decision soon![URL]..
View 5 Replies
Jan 7, 2012
my company (FB games) has fired everyone who knew what they were doing leaving me, with no knowledge of flash, staring at my to-do list near tears, unable to complete basic tasks.I need to take an existing walk cycle animation and replace the character with another design. After breaking the new character body into symbols, I've tried to sub them in using swap symbol. The body parts do not line up with the previous symbols, and they also seem to go flying all over the place when I run the cycle. I can't figure out how to just update the symbols without disrupting the placement.
View 2 Replies
Feb 28, 2010
I am a student with a mainly electronics background getting into programing. The more I get into it, the more I realize how bad I am at it. I am trying to get better at OO design.One thing I have been reading about is the use of Getters and Setters.
[URL]
Now I can see the point they are making here but I am still unable to see away around some simple problems. And this brings me to my question (finally). I am setting up a simple tower defense game in AS3 as a learning exercise. I want enemies to follow way points so I was going to make an array of way points, and make that a property of a map object. And a way point was to be an object with an x and a y property (more like a struct).
View 4 Replies
Apr 3, 2012
I want to create a simple desktop admin application for an IOS app that will work with a REST api I've built.Couple of years ago I would go with Flex/Air, just makes it very simple. But since I am butt-hurt with the way Adobe have handled Flash in general, I am looking to write it using some different tool.So far, Java Swing looks rubbish (UI-wise I mean). Others aren't cross platform and often too complicated.
View 1 Replies
Nov 1, 2011
Is it possible to replace green screen in as3.
View 1 Replies
Mar 4, 2005
The windows pop up, the problem lies in that the pop ups wont replace each other.if one pop up is open, trying to open another one just makes the old pop up active, it doesnt open the contents of the new one. this is a big problem since the pop ups are for my portfolio to show the work at larger sizes. is there a way to tell the new pop up to close the old one and then open? would this be some sort of if... else statment? or is there some other code i should use for the pop ups?
View 1 Replies
Jul 15, 2009
I have a Flash movie (.swf) file embedded within a webpage.I am looking to have an image display if the user does not have Flash installed or has it turned off.
View 3 Replies
Dec 20, 2010
I'm trying to replace some contents in a website by using the following code:[code]The problem is that I have some flash embedded on the DOM and whenever I try to do the replacement the browser crashes.Somebody should thing that a prepend or append in the right place should be a better method
to achieve this, but the elements I'm trying to locate and replace are html comments and the append prepend methods do not seem to work with this kind of nodes so they have to be treated as literal strings.
View 1 Replies
Jun 1, 2011
I have a website that has a Flash banner. For devices that do not support Flash (like iPads) I want to display an image instead. What is the best practice to deal with this situation? Should this be handled from the front-end with JavaScript?Should this rather be handled from the back-end? (I am using Java on the back-end)
View 1 Replies
Aug 12, 2010
I have used loadXMl.as file for XML to Object conversion till date. I am now converting the framework from AS1 to AS3.
Is there any alternate in AS3 for XML to Object conversion other than using the XML class. I am facing a lot of problems with XML class which I am not used to.
Here is the example
[Code].....
though I expect it to show undefined as the tag does not exist in the XML file.
View 4 Replies
Feb 13, 2003
I import my text from a external text file, my text is in html but i have to use a (& n b s p ; ) space to make sure that a part of my text will not drop down on the following line.The (& nbsp; ) code is not understood by flash and make all the following text desappeared.
View 5 Replies
Dec 27, 2010
Inherited some flash widgets that are developed in .fla format and exported to .swf apps, using Flash Pro CS5. I have only limited understanding of AS3 or 4, flex and flash in general, but I'm quickly becoming dangerous.
My bottom line problem is I need to find a command line tool to 'build' the .fla source into .swf entities.
q1: are there any cmd line tools with the Flash Pro CS5 for such purpose? I cant seem to find any, but I may not be looking at the right places.
I know there's such a thing as the Flex SDK, but what's under Flash CS5 at "Adobe Flash CS5CommonConfigurationActionScript 3.0flex_sdk", doesn't seem to have anything useful in it, only a general flex library.
Another requirement I need to solve is to create customer specific, purpose built versions of the widget.
From the Flash IDE, I can figure out how to replace the background images, etc., but.q2: how can I do this at export/build time and later on, via the command line tool?
Basically, a build/compile directive in source would allow the swf builder to replace a given image asset with the version I intend to build with.
View 3 Replies
Jan 2, 2011
I'm making a website in AS3/PHP (databasecalls) and I want to load news on the homepage, fed from a mySQL database. No problem to get plain text with AMFPHP. But I'm looking for something different. I know how to load images/YouTube videos within AS3, so I want to spice up the news a little with that. Is there any way I can input something like
[Code]...
View 2 Replies
Sep 19, 2011
I have a flash (.swf) movie on the homepage of a website which runs automatically after been downloaded to browser. However this is creates problems since the swf soon crashes(with message :The Adobe Flash plugin has crashed) and gives error messages like "A script is becoming unresponsive...." Since rest of my site is pure html and js but flash content makes the site very sucking and I want to replace it with a simple better alternate. What options exist for me to replace flash content?
View 2 Replies
Apr 2, 2011
I want to do something like this:"3*4".replace(/([0-9]+)[*]([0-9]+)/g, String(Number("$1") * Number("$2")))And no, i don't want to do that, but something more complex.
View 2 Replies
Feb 3, 2009
Im having a little problem making javascript communicate with actionScript, Here is the problem, i have a application that uses javascript to communicate with SWF and pass it some values, and the code was working in AS2 with the following:
[Code]....
in this example the aplication would pass key to the javascrip function and the function would put the value in the swf variable called _root.valor. So the problem is (as you already know) _root has gone in AS3. And every thing i tryed so far seems not to work. every thing i read so far was to embeb the swf in the js and use
root.loaderInfo.parameters.valor, well i dont want to use the embedSWF because i need to get the activeX cotnrol from my document. Is there any _root replacement? is anyway to get this to work at all ?
View 5 Replies
Aug 25, 2011
I would like to offer free apps in the Apple App Store, with the apps being ported versions of already existing, Flash-based websites I have created for clients. The website and the app would offer the same experience and mostly the same functionality, for example the portfolio of a company or artist.iPhone and iPad Visitors of the Flash-based website would be informed that there is no Flash available and they would instead be offered a link to the free app in the App Store.Since the clients obviously do make whatever kind of buisness and profit in the physical world, I am afraid that such an app might be considered free advertisement and be rejected from the store.So, is the approach violating Apple's terms and conditions?Is it realistic to offer free apps of that kind on a regular basis, for example as a Flash-focussed agency with many existing clients and projects?
View 1 Replies
Nov 9, 2011
I can use:
navigator.pushView
in ViewNavigatorApplication, but can't use it in TabbedViewNavigatorApplication?
Is there a replacement for navigator.pushView in TabbedViewNavigatorApplication?
View 1 Replies
Jul 28, 2009
making a flash game that has a lot of rather complex illustrator graphics. In the game you walk down a street, so all the graphics has to be moved every frame. In some levels where there are a lot of objects in the street the game starts to lag. after importing it to flash and making a mc of it, break it apart to save flash from drawing all the shapes that aren visible anyway?
View 2 Replies
Nov 12, 2010
just uploaded my first flash website..and I'm having difficulty working out how to get google to 'see' it.
I've registered the site with google and have a very specific phrase in the <title> tag of the html code but the more I investigate, the more complicated it seems..Can anyone point me towards a step by step tutorial or something to get my site in the top 10 results?
View 5 Replies
Aug 23, 2010
Is there any program or setting for "pointing" flash programs at my graphics card rather than leaving it to the processor and RAM alone? I am running a specific frontend software that is a flash executable- unfortunately it lags heavily on execution despite the fact that I have a very nice video card installed.
View 3 Replies