ActionScript 2.0 :: Getting Percentage Similarities Between Arrays/strings?

Oct 23, 2009

long time admirer of the wisdom on this board! I am having a little trouble thinking of a solution to this little problem.So in AS2 (will make the jump to as3 soon, i promise )I have some code that makes arrays of the formn, e, se, e, n they are only 5 elements long at mostI load in some XML with similar arrays, i would love to know if you guys have any suggestions on how i can work out the percentage difference between these arrays.It will be for a gesture recognition type app, but in essence i suppose this section of the code is a spell checker that gives a suggestion for the best match from a custom dictionary.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: How To Put Strings / Functions Into Arrays

Dec 6, 2010

When I experimented with it, I tried to push one string and one function named "moveRight" into the array,
Code:
_behaviours.push("1", moveRight);
trace("_behaviours: " +_behaviours);

But when I trace the content of the array, I get
Code:
_behaviours: 1,function Function() {}

Why is my function moveRight, being renamed to "Function", and how do I call the different functions if I have several of them in one array? The purpose of all this is to make a simple AI system for my game enemies. After the enemies are added to stage, a special function would calculate a random number based on the number of entries in the array and then make the enemy perform the chosen function.

View 3 Replies

ActionScript 3.0 :: Name Arrays With Variables (strings And Integers)?

Apr 21, 2011

i want to choose one of these randomly, I have a loop way in which there is a loop searching for the index number which is inside an array like M1[1]=1 , M2[1]=2 and if I have a random number between 1 and 20 I can loop the arrays [1] element.
 
But is there another way with directly get the random array buy name. For example I have the random number 14 which directs me to M14. how Name of the array help me to choose M14 when I have the number 14....

View 2 Replies

ActionScript 2.0 :: Flash8 Strings, Arrays, And Splitting Errors

Jul 18, 2009

the general goal I'm going for is this: user enters a bunch of text into a textarea. It's parsed word by word into an array, and then the array is gone through. If a certain word (from a list provided by me) is found in the array, then an event will happen later..

[Code]...

View 5 Replies

ActionScript 2.0 :: Arrays/Objects/Strings - Attach A MC Instead Of Text In A Textfield?

Oct 25, 2003

how can i have an array of strings but also with mc identifiers in the same array and have it know the difference between object and string? RIght now i've got this array of strings that goes to a textfield, and if i change it to

portfolioSection(["section 01", "section 02", {linkage: "linkage_id", x: 530, y: 280}, "section 04", "section 05"]);

this.attachMovie(portfolioSection[2].linkage)[/AS]

to try and attach an MC instead of text in a textfield i just get [object object] in the text field.

View 6 Replies

Flex :: Combining A Multiple Strings And Arrays To One DataProvider For Spark List

Dec 21, 2010

what I need to do is combine 5 arrays with 5 individual strings (which have come from a JSON webservice) into one single list item in FlashBuilder Burrito. [code]I've pulled these out successfully and each one traces in the debugger, although as I need them all in the same list I'm struggling to establish them as a dataprovider together.If I push the strings and arrays together it is impossible to read properly, as the main Titles are at a different level to any descriptors for the products which are in the arrays.

View 1 Replies

ActionScript 3.0 :: Push Multiple Strings Into An Array, And Some Of The Strings Are The Same?

Aug 24, 2009

I work on AS3 one week, and then take a break for a few weeks, then work on it a day, take a break, etc.. So I forget some of the basics, and need refreshers. I think I need to stop taking breaks.

Problem: I push multiple strings into an array, and some of the strings are the same.

Code:
var myArray = new Array();
myArray.push (Snivvle);
myArray.push (Kirupa);
myArray.push (Snivvle);

I want to find out which element positions "Snivvle" hogs up. We can see that it would be using element 0 and 2, and if we do an "indexOf" we would only get to see element 0, and doing a "lastIndexOf" we would only see element 2. How do I find out ALL of the element positions "Snivvle" is located in, so that it returns: element 0, element 2.

View 2 Replies

Arrays :: Flash - Pushing Or Adding Arrays As Values Into A Multi-dimensional Array?

Jan 21, 2011

I am running into some trouble adding an array into another array to create a multi-dimensional array.The code appears as below:

var slideDataArray:Array = new Array();
var slideShowDataArray:Array = new Array();
slideDataArray[0] = xmlData.SlideShowParameters.SlideShowImagesDirectory;[code]........


I am looking for a means of placing the slideDataArray into a 'slot' or value of slideShowDataArray so that I can in the end pass the slideShowDataArray as a parameter to another function.As of now, the last slideDataArray appears 11 times (the loop runs 11 times) in slideShowDataArray and the way the code is written the slideDataArray is unique every iteration of the loop.

View 1 Replies

ActionScript 3.0 :: Arrays Of Arrays / Data Providers And Dictionarys

Aug 26, 2009

I've got a bit that loads a big chunk of xml data about products.I push product info into an array(e.g. productArray), then add that array to another array (e.g. allProductsArray)How do I sort those arrays? For instance, if I want to sort the allProductsArray based on the info in productArray[0]?Alternatively, would something other tha an array of arrays be a better route?This loader loads the same sort of info for many different clients, so the bit to sort on will change.

View 5 Replies

Arrays :: Fastest Way To Merge Multiple Arrays?

Sep 26, 2011

I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays.I've done this, but it seems like a really slow and ugly way of doing it:

var ar1:Array = [1,2,3,4,5,6,7,8,9];
var ar2:Array = ['a','b','c','d','e','f','g','h'];
function merge(...multi):Array[code].....

Is there an inbuilt and more efficient / nice way of achieving this? The result does not need to be in the same order as the input - completely unsorted is fine.

View 3 Replies

ActionScript 3.0 :: Randomizing The World! Arrays And More Arrays?

Feb 17, 2009

A little explanation: Im making a random arranging number Array. So instead of using a loop and assigning 0 to first array element, 1 to second, etc.I need to make it totally random but without repeating any numbers. To do that I made a second Array that will have the same number of children to serve as a reference.Each of them will be an Object with a property "num" , wich will be its actual number, and a property "called" wich defaults to false.Like this:

ActionScript Code:
for(var i:int=0;i<vQuantity;i++){
ranArray.push( new Object() );

[code].......

View 8 Replies

ActionScript 3.0 :: Arrays Store References Of Other Arrays?

Dec 27, 2009

I've had a problem for awhile that was really odd. After some intense debugging, I realized the problem lied in setting an array equal to another array.[code] When setting one array equal to another, the values aren't copied over, but a reference to that memory is stored. So no matter which variable you change, they are both references to the same memory and thus both will reflect the changes.With other data types, this doesn't happen.I could fix it by looping through t1 and using push() to add each index from t1 into t2, but that seems a little messy.

View 7 Replies

ActionScript 2.0 :: Pushing Variables To Arrays Within Arrays?

Jun 25, 2004

correct syntax for pushing variables to arrays within arrays? I have searched many threads but found nothing that exactly answers my query.I have a class (Brigade) which amongst other variables contains an array (BrigadeUnits) This is the third element.. My Brigades are stored in an array called AllBrigades. I now need to fill the BrigadeUnits array with objects of my Units class.The hierarchy I want to create is as follows:

AllBrigades (array of Brigades)
Brigade (object)
BrigadeUnits (array within Brigade object)
Unit (Object to be stored in BrigadeUnits array)

I have tried various approaches including the following, assuming that I am addressing the first Brigade in the array:

AllBrigades [0] [2].push (MyUnit);

But when I trace this I just get undefined.

View 14 Replies

ActionScript 3.0 :: XML Percentage Bar?

Mar 19, 2009

Ok so i'm trying to create a percentage bar that automaticlly adjust depending on data pulled from a XML file. and I'm currently have some problems with the data getting to the second frame.. here is what I havethe xml file code:

Code:
<?xml version="1.0" encoding="utf-8"?>
<myxml>

[code].....

View 1 Replies

ActionScript 2.0 :: Fade To A Percentage?

Jul 8, 2008

I'm using the code below to fade in a movieclip and I'd like to know how I halt the fade in at 80% say.

onClipEvent (enterFrame) {
this._alpha = _alpha +6;
}

View 2 Replies

Make A Swf Appaer As A Percentage Of The Screen

Aug 11, 2009

how to make a my swf appaer as a percentage of the screen not a defined size and I can't seem to work it out. I nee something to appear on screen at a resonable size. 640 by 480 is too big for certain users and width="480" height="360" is too small for others.
 
see code I used below:

[Code].....

View 2 Replies

Professional :: Scene Under Flash In Percentage

Apr 26, 2011

Is it possible to have a scene under flash cs 5 with height 100% and width 100%?

View 4 Replies

ActionScript 3.0 :: How To Get Percentage Of XML File Loaded

Mar 26, 2009

How can I get the percentage of xml file loaded. I want to show a preloader and animate it according to the percentage of loaded xml file. I tried using progress event but it gets called only once.

View 1 Replies

Flex :: Open Percentage On Accordion?

Dec 9, 2009

I'm currently developing a Flex application with an accordion containing 2 canvas: one of them containing a DataGrid and the other one a form.When the user clicks on one of the DataGrid's rows, it opens the accordion on the second (form) canvas. However, I'd like to open the second part of the accordion only by half, so they can still see the data in de datagrid.

View 1 Replies

Actionscript 3 :: Percentage Distribution Of Numbers?

Oct 8, 2011

I need to generate 238 numbers, with a range of 1-4, but I want to weight them, so there's say 35% chance of getting 3, 28% chance of getting 2, 18% chance of getting 4m, and 19% chance of getting 1.

[Code]...

View 2 Replies

ActionScript 2.0 :: Percentage Loading Bar But For A Movieclip?

Mar 10, 2005

i need to do a loading bar for a specific movieclip, not the whole file.

i have 9 clips to load, and i dont load them all at once.

on my main timeline i have 9 movieclips and 9 labels to jump to them but i need to have a loading bar for each..

here is an excerpt of what i used to have the whole movie to load, but it does not work if i use a movieclip in the timeline..

bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;

[Code].....

View 2 Replies

ActionScript 2.0 :: Percentage Preloader Of Swf File?

Jan 16, 2006

i want to play a cardiogram (some movement) ant to see percentage preloader of swf file in the same time and then loading is compleated see the swf which was loaded i can't insert a preloader.

View 2 Replies

ActionScript 2.0 :: Percentage Preloader - How To Use Root

Apr 17, 2003

I have a question, I have been reading on _root. ... My question lies with the use of a percentage pre- loader.
_root.getBytesTotal();
If I place this in the first frame of movie A and load movie A into Movie B, movie B being the main movie, will the get bytes loaded give me total bytes of B, or A... My initial thought is it will get the total of B seeing how I am using _root.

View 3 Replies

ActionScript 2.0 :: Showing The Zoom Percentage?

Mar 16, 2006

getting my zoom function to display the percentage that has been zoomed in or out. here is the code for the zoom function. this function works, how to display the zoom percent... like if its at 50%, or 120%, etc...

also how can get it to add some easing when it zooms, so that it gives a smooth zoom in & out effect, i've tried a few things, but didn't work...

//zoom function
//this is percentage at which the mc loads on
var myScale:Number = 47;
//max zoom limit

[Code].....

View 3 Replies

ActionScript 2.0 :: Using Preloader With Percentage From The Kirupa Tut?

Jun 22, 2003

Using this preloader w/percentage from the kirupa tut.

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;

[code]....

I'm having trouble calculating the getBytesTotal method to return less that the total. In other words, I'd like to start the movie before it has fully loaded. Lets say, 75% loaded then gotoAndPlay.

View 3 Replies

ActionScript 3.0 :: Show Image At Certain Percentage?

Feb 24, 2010

Is there a way I can do it so at a certain percentage of the preloader a image shows up? Like lets say from 0-49% the background is black then once it hits 50% an image shows up as the background, and stays there until 100% so basicly 0-49% = black background and 50-100% = show an image as a background Is that possible? Also, here is my current code I would like to add that option to: [php]stop(); this.addEventListener(Event.ENTER_FRAME,

loading); function loading(e:Event):void { var total:Number = this.stage.loaderInfo.bytesTotal var loaded:Number = this.stage.loaderInfo.bytesLoaded; bar_mc.scaleX = loaded/total; 

[code].....

View 7 Replies

ActionScript 2.0 :: Swf Percentage Preloader On First Frame?

Oct 10, 2007

I would like to use animateFlourish.fla (see attached file) as a percentage loader in the first frame of a movie where the beginning of the animateFlourish animation equals 0% of frames loaded and the end of the animation equals 100%.I have tried the percentage preloaders tutes here on Kirupa and on Senocular; but, none of them work.So far, I have been able to get the animateFlourish.fla to work as a preloader; but, it keeps replaying the animation until the frames have loaded: http:[url]... I would like it to play once timing the animation with the % of loaded frames.

View 1 Replies

ActionScript 2.0 :: Get Perfect Scroll Percentage?

Oct 22, 2009

i want get scroll percentage form 0 to 250 point having a Line large 95px and dragger large 10px. I make this script but it dont perfect to get value. It's fast to update value.[URL]

dragger.onPress = function() {
dragger.startDrag(false, 0, -14, line._width-dragger._width, -14);
this.onEnterFrame = updateValue;

[code]......

View 1 Replies

ActionScript 2.0 :: Hit-test Score As A Percentage

Oct 31, 2009

I'm making a platform game called Kit Run. Th objective in each level is to gather 100 points in hidden pickups. I want to have the score read as a percentage - when you start the score says 0%, as you collect, depending on the worth of the item, it goes up by such and such %. How I am attempting to do it: on the stage I have three dynamic text boxes. one "pointsEarned", one "PointsTotal", and one "scoreText". The actionscript on the stage is:

[Code]...

alas it doesnt work. The score stays forever at 0%, even though when I hit the chicken mc it unloads properly. I've been writing and rewriting it for HOURS and I cant figure it out.

View 11 Replies

ActionScript 3.0 :: Flash Preloader Percentage In IE

Jun 30, 2010

I've got a flash site which works fine... except, the preloader percentage in IE is.. well.. not how it's supposed to be... I tested it on every popular commercial browser and it goes from 1 to 100... in f...ing IE it persistently goes from 1 to about 470... ?!?!?! WTF?! btw: the preloader has a rotating circle and a text which displays the percentage... here's the code:

[Code]....

View 3 Replies







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