ActionScript 2.0 :: Make A Function For Array Combinator?
Dec 18, 2010
i try to make a function for array combinator but i couldnt. "n" is elements like Combinator(arr,3)
var arr:Array = [a, b, c, d]
function Combinator(arr,n){
if(n==2)
return combinations:Array = [[a,b],[a,c],[a,d],[b,c],[c,d]]
if(n==3)
return combinations:Array = [[a,b,c],[a,b,d],[b,c,d]]
}
View 4 Replies
Similar Posts:
Aug 25, 2009
How do I make the color array, dColors, an optional parameter?[code]It gives me a "1047: Parameter initializer unknown or is not a compile-time constant."I've tried a bunch of different ways, but all I get are compile errors.Don't forget to drop a colorpicker control in to your library if you copy out the code.
View 2 Replies
Sep 8, 2010
I'm just trying to make a utility function to convert an array collection into a string.
Supose my item within the array collection (named 'ac') is something like:
Code:
var ac:ArrayCollection = new ArrayCollection([{property:'foo'},{property:'bar'}]);
I can get the items property if I use a 'for' loop like:
Code:
var acToStr:String = "";
for (var item in ac)
{
[Code].....
View 4 Replies
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
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
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
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
Jan 23, 2007
this is my code for photogallery.there will be 61 images loaded in this array.how can i make an AUTO button which will make a slideshow,showing all the images in array?
arrayrow = new Array()
arrayrow=[
["00.jpg","0","sajkad","hjsgadhj"],[code].....
View 5 Replies
Sep 23, 2009
this is the function i want to turn in to a static function. just dont know how to make it a static function and call it from other classes. i think this would have its own file.
[Code]....
View 2 Replies
Jul 1, 2010
ActionScript Code:
myFunct();
function myFunct()
{
[Code].....
Any way to get this to work without using much more code? This is for a function that checks to see if a user is still logged into a website. I need the check to happen every time the user causes certain functions to run, like create topic, submit new post, etc. I could put the code, which is only a two-liner if/else statement in every function, but it would be nice to just call a single function. But that function would have to be able to cause the function that's calling it to return to get it to cease.
View 5 Replies
Apr 23, 2009
I was just curious if an array can make itself.ie, I want an array to be [1,1,1,1,1,1,1,1,1] that sounds silly but there is a reason for it.So without having to say 1,1,1,1,1 dozens of times is it possible to just have some variables, 1, and 100, and have the array make 1, 100 times?or have while (array length = = 100? array = 1?
View 1 Replies
Jul 19, 2005
How do I make a prototype for a function like... mc.attachMovie() , or mc.nextframe(). Know what I mean ? the argument of the funcion is the mc.
View 2 Replies
Mar 16, 2011
an example when you might need this? Also what is this output? it hurt my brain
PHP Code:
func1();function func1(){func2(); function func2() trace(this);//[object global] }
[code].....
View 4 Replies
Jan 6, 2009
I recently did the hover caption tutorial, and it works great. Only thing is, I didn't like how the caption box was never quite the right width for the caption text. So I decided to create all my captions and try to use an array, and one of the arguments in the function would call the caption using the array. The variable "cap" is assigned to the array variable in the function, which corresponds to the instance name of the caption to use. It traces right, but it won't grab the caption. The code works fine if I substitute the "cap" variable for the instance name of the caption. I've tried moving the variable around but it still won't work. Here is the code.
function call: (used in onRollover)
captionFunc(true, 0);
function: ("capChoice" is the array function).
function captionFunc (showCap, whichCap) {
[code]...
View 1 Replies
May 10, 2009
I've been having a few problems with accessing an array from a different function.
The array I want to use is from the makeFly function, which generates instances of the Fly MovieClip. I want to access the array from the paperSwing function, which should test for a collision between the mouse cursor and the fly movieclip, and then if true remove the instance. This is the part where I'm having a bit of trouble, I'm not sure of how to access the array "name[i]".
This is from the "Main" Document class:
Code:
package {
import flash.display.*;
import flash.events.*;
[Code]......
View 2 Replies
Sep 13, 2011
I'm having trouble accessing the turnQueue array which is being updated in the first function and accessed in the second, no idea what the rules are between functions for actionscript. Heres the code, I want the turnQueue to be growing as keys are pressed, and at the moment its not updating from the first function.
public function keyListener(e:KeyboardEvent):void {
trace("Key Entered");
if (e.keyCode > 36 && e.keyCode < 41) {
[code]....
View 2 Replies
Feb 25, 2009
Is there a way to invoke a function using the function's name if it is stored in an array?[code]...
View 2 Replies
Apr 16, 2009
I have 4 buttons and on release of any of the buttons it will call a function. How do you apply a function to any member of an array?I've placed "any_btn" into my code below to show what I mean
Code:
var btns = Array("btn_1, btn_2, btn_3, btn_4");
any_btn.onRelease = function(){
trace("working");
}
View 2 Replies
May 10, 2009
I am fairly new to actionscript, I've been having a few problems with accessing an array from a different function.
The array I want to use is from the makeFly function, which generates instances of the Fly MovieClip. I want to access the array from the paperSwing function, which should test for a collision between the mouse cursor and the fly movieclip, and then if true remove the instance. This is the part where I'm having a bit of trouble, I'm not sure of how to access the array "name[i]".[code]...
View 2 Replies
Sep 13, 2011
I'm having trouble accessing the turnQueue array which is being updated in the first function and accessed in the second, no idea what the rules are between functions for actionscript. Heres the code, I wanted the turnQueue to be growing as keys are pressed, and at the moment its not updating from the first function.
[Code]...
View 1 Replies
Jan 12, 2012
I have flash application, which creates array and calls javascript function.[code]My question is how to pass params from actionscript to javascript as array and not as string value.
View 2 Replies
Oct 20, 2009
I'm trying to use an array to store function names then recall the names later to execute the fuction.
Here is the code that I'm trying to use...
function BackClick(evt:MouseEvent):void{
var RedoPop:Object=MovieClip(parent).Undo.pop();
MovieClip(parent).Redo.push(RedoPop);
[Code].....
The variable "UndoPop" contains the name of a previousely defined function and I would like to let flash know to execute that function.
View 0 Replies
May 3, 2010
I have a function call as shown here: ActionScript Code:c.draw(colorRead.population); In this function, I would like it to be able to print out population as part of the string for my toolTip. Note, what is in the parameter here may not be the case in every of the instance I need to create.
[Code]...
View 1 Replies
May 16, 2010
I was wondering if it was possible to push an array of boxes for example, through a function so that it formats all of them?
I've tried looking this up, but I have no idea what it would be called.
View 4 Replies
Nov 20, 2010
i'm trying to get out an array from a function in a class.
private function loadData():void{
trace(xml); This is ok xml have a value
for each (var item:XML in xml.items.item)
{
[code]....
View 3 Replies
Mar 12, 2011
I'm trying to apply a function to an array of movieclips, rather than have to type out the function for each one. So, if my movieclips were mc1, mc2 and mc3, I would have:
Code:
function Invisible (movieclip){
movieclip._alpha=50;
}
[code]....
This does not work - I still have to put Invisible(mc1) for each object to make it work. Is there a way to use arrays to do this?
View 3 Replies
Oct 19, 2011
when doing something like passing an array of movieclips to a function then trying to access the name of the movieclip (a[i].name) why does it give instance names instead of the names passed in.
Here is example code from a function I'm trying to use to enable whatever navigation movieclips i pass into it:
ActionScript Code:
function enableNavButton(a:Array):void
{
for(var i = 0; i < a.length; i++)
{
[Code]...
View 3 Replies
Nov 6, 2005
This code works fine for loading a pic into a created container and placed centered in a box_mc.I am trying with no luck to have the same thing repeat itself x number of time.
My idea is:
array=[1, 2, 3];
var a = 0;
[code].....
View 5 Replies
Apr 2, 2007
Is there a function that searcher for a value in an array? And if it finds that the value is in the array it returns the index of where the value was finded?
View 8 Replies
Feb 7, 2008
I'm forgetting the correct syntax here. I've got a function that I want to feed an array of movie clip names into, like so:
Code:
var clipArray:Array = new Array();
function revealDetails(clipArray):Void {
[code].....
View 2 Replies