ActionScript 3.0 :: Array Comparison Isn't Working?
Jan 24, 2012I try to compare two array
if (comparisonArray == restriction)
{
trace ("Its a match");
[code].....
I try to compare two array
if (comparisonArray == restriction)
{
trace ("Its a match");
[code].....
Pattern_Array (created by a random function that pulls from Words_Array and stores the index)Now I want to create another array called Choices_Array that will compare Pattern_ Array to Words_Array and not repeat any of the Pattern_Array index's in the new array.
View 1 RepliesI'm looking for a good method to compare a single bitmap data instance against an array of stored bitmap data objects. I need to figure out how I can compare and arrive at the conclusion that the result either means that the images are of the same object/aka similar or if they are two totally different images. I tried checking threshold of the result of the compare() function but my efforts have failed so far.
View 5 RepliesI have used a method to shuffle a part of a Array, but i noticed that it does not work very well.When i run this method I sometimes get empty array values.So if you would try the example below and test it out some times you would get a right result but sometimes a wrong result.For example when i run this i get in my trace output:
a,b,c,d,g,,e,f (here after the g it goes wrong)
a,b,c,f,g,d,e (here it goes right)
a,b,c,d,,g,f,e (here it goes wrong)[code]...
I have a problem that bugging me and hindering me from advancing to next part of the game. I'm very much behind schedule because of these weird behavior. (Well I blame my ignorance for not properly coding them)
I'm trying to do a simple click-and-match game where there are 18 items to flip but only 10 items (5 pairs) are the valid answer. The problem lies with this part:
[Code]...
Are there a good overview/comparison of Flash-authoring tools somewhere online?
By "Flash-authoring tools" I mean "Flash Builder vs. OpenLaszlo vs whatever", not Silverlight or JavaFX.
I am currently digging into the whole Flash 3D stuff and I am quite unsure which engine I should use. I really prefer haXe for development but ActionScript 3 is also fine.My current candidates are:
Papervision3D
Alternativa3D
Sandy 3D (only engine with native haXe version)
Away3D
I want to create a photo browser web widget that can be embedded in a web page (e.g alice's blog) but I am not sure whether I should go the flash or javascript route. Flickr went with a flash based widget. Why would they do it in flash over javascript? why would you chose js based widget over flash.
View 1 RepliesUnable to get ll = -15 even when the Flex builder console show correct result. Which part could I go wrong?
//b-a = (3) && c-a = (6)
if((naArray[i+1]-naArray[i])<=3 && (naArray[i+2]-naArray[i])==6) {
ll=-15;
}
I have a puzzle game, in which the user can define how many pieces will the puzzle have. There are some problems in the entry validation. I pass the data in a custom event, and then check if they are numbers, if they're not, then go with the default values.
I'm getting this warning: Warning: 1098: Illogical comparison with NaN. This statement always evaluates to false.
It turns out the warning is right, even despite the traces, which (when I input letters instead of numbers), show both variables as NaN.
Code:
private function initGame(e:MenuEvent):void
{
game = new Game();
game.addEventListener(GameEvent.OVER, onGameOver, false, 0, true);
[code]....
I've been trying to compare two strings. One from an input text field, input_txt, and the other a variable. For some reason, even though both trace out exactly the same, it's not seeing a match.
[Code]...
First time working with numeric comparison,[code]But, the code is not functioning. I don't want to use if .. else construct.
View 11 RepliesI googled it and found some old results like bubblemark.com, link text and link text. But is there any recent benchmarks as all the platforms have been updated. I like to measure the speed of silverlight 4 against the modern and faster javascript engines.
View 1 RepliesI'm on the brink of finishing the first iteration of my first game ever o/ and of course the last item I need to complete is the hardest. I am making a simple word game, and all details aside, the task at hand is a conditional block to determine whether the word the user has entered is real, and in order to do this I need to somehow compare it to a dictionary list.
1 hour of research has quickly opened up an entire universe of data structures, open source xml documents, people willing to take my money for spell checkers, and of course RegExp which I have no experience using (but am willing, and wanting, to learn!). One of the main problems Google is giving me is the addition of the Dictionary class in AS3, which "lets you create a dynamic collection of properties, which uses strict equality (===) for key comparison on non-primitive object keys..." So finding previous literal dictionary uses is tough.
I soon found taking a dictionary txt file (118619 lines) and converting it line by line into an array takes 3 minutes on my beast of a laptop gaming rig (Asus W90), and while I knew this was a bad idea, it was a nice learning experience (to give me a gauge of processing abilities).
I am wondering whether using XML is an appropriate alternative, or if there is a way to externally access a dictionary somewhere online. Looking at the XMLList Class available I see text() and toString() methods; yet I still see heavy iterations in accessing the dictionary.
Which brings up the next point: easiest way to find a String match. I understand that comparing each word one by one would be tedious for the program, so maybe splitting up the list by letter (or maybe string length, looking at the file), or first and last letter.
I'm loading data from XML file, and in XML file Date will format like YYYY-MM-DD, e.g. 2008-05-05. So in flash when I'm using getDate() it will display date like 2008-5-5 so that in comparison of date it will not compare.... I'm not able to check 2008-05-05 to 2008-5-5.
I'm getting date from following code
var tdate= new Date();
var date_str:String = (tdate.getDate()+"-"+(tdate.getMonth()+1)+"-"+tdate.getFullYear());
For some reason, I'm having a hard time finding a recent, side-by-side comparison of the various pros and cons of the different open-source flash 3D engines, such as Papervision3D, Away3D, and Sandy3D. Specifically, I'm looking for comparisons in the areas of
ease of use (and documentation) performance (framerate with lots of polygons) stability (bugs, glitches, graphical artifacts) currency (for lack of a better word - is the project gaining or losing team and community members?)
language(s) used (is it in as2, as3, flash-player-10 as3?) features (lighting and shadows, import models and animations of various formats, click detection, collision detection)
This is reasonable, right? I don't want to essentially pick one at random, only to find myself in trouble later on. Working with papervision3D, I'm already frustrated by the documentation, or the in-name-only nature thereof - most functions only have headers listed and no descriptions of what they do. Personally, I like to be able to pour through the documentation and figure out how to do whatever I want, and I feel like I'm fumbling around in the dark, having to read the source and try to understand all the implementation details. Who's used multiple open-source flash 3D platforms?
i've been using different loaders in the past, here are the most popular:.
[Code]...
which one is the best one and for which challenges?
I'm having difficulties with my switch script. Below is the code:
Code:
public function resultValue():void {
switch (_calcSwitch) {
case 0:
break;
[Code]...
My company is willing to reffactor its biggest and heaviest project introducing some kind of framework. Are there good online source/issue/blogpost with comparison of these 3 frameworks - Robotlegs, Swiz and Mate?
View 4 RepliesCode:
var myArray = new Array;
myArray = [{value1:"1", value2:"something1"},{value1:"2", value2:"something2"}];
trace(myArray); //return [object Object],[object Object] (whole array)
trace(myArray[0]); //returns [object Object] (first entry)
trace(myArray[1]); //returns [object Object] (second entry)
How do I trace value1 and value2 from each entry I thought it would be something like this but I guess not
trace(myArray[1,["value1"]]);
when my ship lands within certain coordinates i want to add a docking button to to a child of another movieclip. Then I want to add the docking button to an array so that when thrusters are engaged i can remove that child.The docking button does get added to the screen but all i get is undefined when i trace out the the DocksArray.Here's where i declare it up under class:
Code:
var DocksArray:Array = new Array();
within the update function i try to trace DocksArray:
Code:
ship.moveShip();
ship.rotateShip();
//scaleWorld();
[code]....
I'm creating multiple movieclips, containing a TextField and an image as a background. In order to keep track of them I'm storing them in an array. The problem is that I can't add the movieclip to the screen >.< What I'm doing is
PHP Code:
addChild(movieclips[0]);
but it's not displaying. I know it's not the movieclip as I can addChild that and it shows, but trying to call it out of the array is not working and it's REALLY frustrating the nark out of me .How do I add the selected movieclip out of my array?
I'm having an issue with my code where im trying to make a different movieclip play every 2 seconds on the start screen for a school project. Simply by changing the array access number however flash is giving me an error code and I've narrowed it down to (i believe anyways)something wrong with my " mcArray[i].gotoAndPlay(2); " because it works fine if i just put the name of the movieclip but not with the array.
The error code is:
TypeError: Error #1006: value is not a function.
at OpsAPP2_fla::MainTimeline/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
[code]....
Can't get this to work for some reason.
<fx:Declarations>
<s:ArrayList id="mathChoices">
<fx:String>ADD</fx:String>
[code]........
I created a prototype function for the Array object. It's supposed to load and parse an XML file, then take all the values from the XML file and convert them to objects, which I then want to push to the array that called the function. However, I can't seem to get it to work.The function itself seems to work, but the push to the array does not. (code below)
Array.prototype.xmltoArrObj = function( path ) {
var xmlurl:String = "nav/" + path + ".xml";
var attr:String = "";
[code].....
Code:
var numOfChars = 0;
setCharacters = new Array();
if (empty1.hitTest(_xmouse,_ymouse,false))
[Code]....
i have the following 2 functions.[code]when i called the first function it works... peopleOffBus(); but then when i call the other function to make p visible true, the function peopleOnBus(); doesn't work.it is calling the function but somehow my array is not working or something.
View 1 RepliesI seemed to have had this problem a few times. I use the <b> (bold) tag in my array and if I don't embed the fonts, the bold seems to work out fine, but once I embed the font, I lose the bold.
View 3 RepliesI'm trying to set up an app that moves one movie clip to the top of the screen, regardless of where it is or how deeply it is nested. To do this, I take the full path of the movie clip and go in, movie clip by movie clip, putting the depth of each nested clip on top. This part works perfectly. Afterwards, I want to move everything back to where it was. In the first step, I store the current depths of everything in an array before changing depths. In the second step, I'm trying to change everything back to its original depth, as shown in the array.
The code is below:
_global.videoPath = _root.clip1.clip2;
var pathString = String(_global.videoPath);
var videoPathArray = pathString.split(".");
var depthArray:Array = new Array();
[Code] .....
I'm having three movie clips, which I would like to move randomly within a set box. The following script works with one movie, but not with all movies placed in an array.
var clipSpeed:Number= 1;
var speedX:Number = 0var speedY:Number = 0
var upperLeftLimit:Point = new Point(0, 0)var bottomRightLimit:Point = new
[Code]......