Actionscript :: Creating A Function That Tests If An Array Contains Something?

Jun 19, 2011

openList = Array([1,1], [2,3], [4,5]);
containss = function (input, arrayData, tellID) {
for (i = 0; i < arrayData.length; i++) {
if (arrayData[i] == input) {

[code]....

This code returns false when openList contains 2,3. When I add trace(arrayData[i]), I get 1,1 2,3 4,5 and when I do trace(input) I get 2,3.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Creating Array With Dynamic Names From Within Function?

Oct 15, 2009

I've got an array (slides) that I parsed from an amfphp return that contains the following data in each array element:
slides = (chapterName, lessonName, slideName, slideText), for every slide in the course

I'm trying to get arrays out this that will look like:
chp1Array = list of Lesson names in that Chapter
chp1Less1Array = list of slide names in that Lesson
chp1Less2Array
chp2Array
chp2Less1Array
chp2Less2Array
chp2Less3Array
etc. etc.

This wouldn't be a problem in as2 but I can't get it to work in AS3 because it gives me errors when I try to create the arrays with dynamic names from within the function? How to get the dynamic number into the array name...

View 9 Replies

Arrays :: Actionscript 3 - Creating A New Array For Eache Iteration Of The Function Call. AS3

Oct 5, 2011

so I have writing a function that returns objects on the stage and puts them into an array. and the function works fine until i call the function on more than one object name, meaning if im in the root class, and I call this function on object1 lets say it will add all the object one's from the stage, but if i call it on object2 it will throw an error, which makes some sense, i guess it means that it is not adding it to a unique array, but im not sure how to do that. would it be a good idea to maybe make a multidimensional array? if that is the case would it be too slow?

[Code]...

View 1 Replies

ActionScript 2.0 :: Array Text Into Textfield And Creating New Line For Each Array Element?

Oct 4, 2006

I have an array called dropTarg1 which stores dropped-in items.I want to loop through this array and in a textfield, display each array item on a new line of this text fieldI think I need to use something like Array.join("/n") but I can't get it working properly. I hope that the /n would create a new line of the text field called reviewBoxContentText.

for(var i:Number = 0; i<dropTarg.length; i++){
with(reviewBoxContent.reviewBoxContentText){
autoSize = true;

[code].....

View 2 Replies

MX Hit Tests Won't Always Work?

Dec 28, 2009

Macromedia Flash MX 2004 I posted this somewhere else - but then realized no one actually uses that forum except to post ads...

Quote:
onClipEvent(enterFrame){
if(this.hitTest(_root.blaze))
_root.floor.speed = -20;
else{

[Code]...

I won't post the file because I'm using someone else's character and it's fine with them, but I doubt it should be here - this is the only code that's a problem, though.

View 12 Replies

Setting Up Functional Tests In Flex?

Apr 23, 2010

I'm setting up a functional test suite for an application that loads an external configuration file. Right now, I'm using flexunit's addAsync function to load it and then again to test if the contents point to services that exist and can be accessed.

The trouble with this is that having this kind of two (or more) stage method means that I'm running all of my tests in the context of one test with dozens of asserts, which seems like a kind of degenerate way to use the framework, and makes bugs harder to find. Is there a way to have something like an asynchronous setup? Is there another testing framework that handles this better?

View 3 Replies

Organizing FlexUnit 4 Tests In FlexBuilder 3?

Jan 24, 2011

I've recently started practising test driven development - thus far I've been working on a library project, so I've organised my FlexUnit tests in a separate FlexBuilder 3 project, linking against my library's swc.Now I'm working on a web app and wondering how best to organise the tests for this. At the moment I've put them in a src/test package in the project I'm testing, with the test runner application at the same level as the default application. Is this the best way to do it, or should I have a separate test project and link in the source for the application I'm testing?

View 1 Replies

ActionScript 2.0 :: Calling A Function With An Array Variable As Arguments Is Resetting Array?

Oct 12, 2006

I'm going to post the full code of the two functions, disregard the "fluff" unrelated to the two functions as it is all working flawless, I've tested this HEAVILY and cannot understand why it keeps setting the entire array to undefined!

Code:
// processReplace Function
function processReplace(transferFiles) {
var processArray:Array = transferFiles.slice();

[Code]....

Basically it's supposed to check to see if the file exists and return as true if it does and add it to a replace array, then the replace array is processed into a single string and put into a dialog box through the flash wrapper prompting them to "replace the files or not".

It makes the replace array just fine, it actually even has the right "count" in it but it's setting all the "filenames" to undefined because of the exists = processSearch function.

I even tried to make a new array and run the search just from that one and set the values from the old one and it's still failing.

Is it because of the "break" or can anyone figure it out? Iknow it's hard because you can't use the code

View 1 Replies

Flex :: Include Unit Tests In A Library?

Nov 24, 2009

I'm working on a general code library for ActionScript 3.0 called as3lib which includes several extensions to the core API and some useful functions. I've written several unit tests (using FlexUnit) to make sure everything is working correctly.

What is the best way to organize these tests in the library? Currently, I have all my code in src/ and my tests in test/ but I've set up a secondary Flex project to run the unit tests. I am also manually adding and removing the test files from the library when I want to run the tests.

Preferably one where the compiled library doesn't include the test files but I don't need two separate projects to test them.

View 4 Replies

Actionscript :: Programming Tests For Flash Developers?

Feb 19, 2010

What programming tests do company's give Flash developers?

I would like to level the playing field for developers and recruiters.

I've heard companies give debugging tests with broken documents you have to fix. Flash developers could include Flash IDE users and actionscript programmers.

Everyone would like to know what to expect and understand some of the blind spots we face. A rundown on "what to be prepared for" may be a right answer. Best anecdote or inside scoop on major companies is good too (don't have to use real names, it's up to you). Perhaps you have an opinion of what is fair or reasonable, I'd like to know.

View 6 Replies

Flex :: Writing Integration Tests For App Using SqLite?

Jun 28, 2010

I want to write integration tests for a Flex application using pureMVC architecture.The back-end is sqlite.

View 1 Replies

Actionscript 3 :: Write Unit Tests For Dictionary

Jan 20, 2012

This is kinda related to my other question: flex dictionary bug? The HashMap has a method getValues() which returns an array of values:

[cODE]....

the loop for (var key:* in map) iterates the keys of the dictionary map, but it seems its implementation does it in some random way. What is the best way to write a test since I don't know what the array returned by getValues method will contain? I thought I could do it by calling the sort method, and compare the values, is there a better way to do it?assertEquals(map.getValues().sort(), "value A,value B,value C,value X,value Y,value Z");

View 1 Replies

ActionScript 3.0 :: Boolean Tests Combination Of Values

Nov 12, 2011

The objective is when user clicks on any combination of 2 buttons you would then gotoAndPlay a new page based onthe two specific buttons you have selected? Ideally user would be able to intermix the button combinations. Code below only works for two specific buttons, but doesn't allow to intermix button clicks.

[Code]...

View 5 Replies

ActionScript 3.0 :: Positioning Works In Tests But Not In Browser?

Oct 25, 2010

I wrote an app that uses the stage.stageWidth and stage.stageHeight to position various elements. It works beautifully when I run the swf in the standalone player, but when I upload it to a site and view it in the browser the positioning is all wrong!

View 2 Replies

ActionScript 3.0 :: Boolean That Tests Combination Of Values?

Nov 11, 2011

The objective is when user clicks on any combination of 2 buttons you would then gotoAndPlay a new page based onthe two specific buttons you have selected? Ideally user would be able to intermix the button combinations.

I've attached a simple diagram that visually explains objective of actionscript.

Code below only works for two specific buttons, but doesn't allow to intermix button clicks.

[Code]...

View 4 Replies

ActionScript 3.0 :: Store A List Of Parameters Needed For A Function In An Array And Then Use That In A Function Call?

Jun 23, 2009

is it possible to store a list of params needed for a function in an array and then use that in a funciton call?

[Code]...

or something like that?? Prob have to iterate the array but how do i get the params into the function call? Is this even possible?

View 6 Replies

ActionScript 3.0 :: Function Returning Array And Declaring A Function With Event And Variable?

Jul 27, 2009

is it possible to declare function this way

ActionScript Code:
function startShake(e:MouseEvent, num1, num2):void

what i mean is it possible to send to the function not only en event but also a variable and a second question how can i access

ActionScript Code:
function stopShake(e:MouseEvent):Array

this array that function return.

View 1 Replies

ActionScript 2.0 :: Filling Function Arguments With Array Items, Function.call()?

Feb 28, 2008

I have this code but I cannot work out how to fill in function parameters based on an array and it's length, see line 7

[AS]
import com.robertpenner.easing.Cubic;
MovieClip.prototype.framesTimeout = function(func:Function, frames:Number, args:Array) {

[code]....

Is it possible to call a function and fill in the parameters based on an array and it's length?

View 1 Replies

Reset Database To Known State Between FlexUnit4 Integration Tests?

Oct 24, 2010

I have a Flex web app that communicates with a Java back-end via BlazeDS. The Flex client is composed of a flex-client module, which holds the views and presentation models and a separate flex-service module which holds the models (value objects) and service objects.

I am in the process of writing asynchronous integration tests for the flex-service module's RemoteObjects using FlexUnit4. In some of the tests, I modify the test data and query it back to see if everything works (a technique shown here: [url]...

How do I go about resetting the database to a known state before each FlexUnit4 test method (or test method chain)? In my Java server integration tests, I did this via a combination of DBUnit and Spring Test's transactions -- which rollback after each test method. But these Flexunit integration span multiple requests and thus multiple transactions.

View 3 Replies

Flex :: Configure Eclipse To Run FlexUnit Tests Automatically?

Jun 8, 2009

I'd like to set up my projects in Eclipse to run FlexUnit tests everytime I save my work.

I found an example with JUnit here : [URL]

How would you do it? Is it possible to run FlexUnit tests without Flash Player?

View 3 Replies

Flash :: Selenium (or Other Record / Playback Tool For Authoring Tests)?

Nov 1, 2010

is there something like Selenium for Flash? Or any other record/playback tool for authoring tests for Flash?

View 3 Replies

ActionScript 3.0 :: Getting Good Collisions Between Balls And Also Using Hit Tests To Trigger Sound

Apr 29, 2010

im building a sound toy that has four balls that can be thrown around and will bounce of each other. when each ball collides i have a chord to be played through a hit test for each pair. im having a problem with getting good collisions between balls and also using hit tests to trigger sound.

View 1 Replies

ActionScript 3.0 :: Collision - Sweep Tests For Fast Moving Objects

Feb 7, 2010

has anyone found an AS3 source/Maths-lib etc that covers not just simple collision tests but swept collision tests (at least swept AABB/circle tests) for fast moving objects? I had a quick look at flixel but even that does not seem to have sweep tests for fast moving objects.

View 2 Replies

ActionScript 3.0 :: Making Hit Tests Work With Multiple Instances Of A Movieclip?

May 18, 2011

I seem to have a bit of a problem with getting the collision detection working in harmony with the rest of my code. Basically i have an array that creates multiple instances of a movieclip named mcPlatformStandard with the following piece of code...

Code:
//this variable holds all of the platforms
var platformHolder:MovieClip = new MovieClip();
//adds the platform to stage

[Code]....

View 1 Replies

Flex :: Flash Builder: Change Default Suite For Unit Tests?

Dec 7, 2010

What are the steps to change your default suite when running unit tests in Flash Builder 4 with PureMVC?

View 2 Replies

Flex :: Continuous Integration - Run Unit Tests From The Command Line On Linux?

Mar 12, 2011

I am setting up a FlexBuilder build under Hudson/Jenkins on a Linux system. I want to execute our unit tests, but do it without using the standard GUI-based test runner.

View 1 Replies

ActionScript 2.0 :: Textarea Tests Fine But When Uploaded It Doesn't Load .txt File

Nov 16, 2005

i've created two textarea fields that pull data from a textfile in the same directory and formats it with CSS. it tests fine on my computer, but when i upload it, it doesn't show the txt file contents. It's just blank. I've been looking around everywhere to try and find a solution, but i can't seem to find anything. Also, the scrollbar on the side of the textarea doesn't load in IE but loads in firefox.

[Code]....

View 8 Replies

Creating And Calling Array Dynamically

Jul 1, 2010

I would like to be able to create and call an Array dynamically. So to pass a name through a function and create an array based on that name.Then to store values into sections in the array. I got the creating the array dynamically working, but I can't seem to store into it.

Code:
Sort = function (numOfVars,Name,toSort){
This works
_global[Name] = New Array(New Array (),New Array());
This does not work
_global[Name][i][c]= 3
This does not work
_global[Name + "[i][c]"]= 3
This does not work
_global[[Name][i][c]]= 3
}

View 1 Replies

ActionScript 3.0 :: Shortcut For Creating Array?

May 4, 2010

I want to create values in an array 1-25, and I was wondering if there was a shortcut or do I have to actually type in the numbers from 1-35?var shortArray:Array = shuffle([1,2,3,4,5,6,7,8,9,10 etc.]);

View 2 Replies

ActionScript 3.0 :: Creating Array From XML File?

Nov 18, 2011

Currently my application uses the following arrays to populate a map with data depending on the user's selection.
 
<fx:Declarations>
<fx:Array id="fwo1">
<ammap:MapArea instanceName="borders" color="#FFFFFF" mouseEnabled="false"/>
<ammap:MapArea instanceName="SE" title="SWEDEN" value="4447100" customData="

[Code]....
 
After much searching, I just haven't quite found an example that will let me make the leap from hard coding to dynamically loading the data (in large part, because of the name space declaration as part of the array element).

View 2 Replies







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