[Test] Array Painter - Webstart
I have made a program which creates 2D arrays and I have just made a webstart which means that the program can execute directly from the website.
I would like to know if anyone out there has got a computer with an older version of java than 1.5.0. If so, please try to execute the program from http://www.arraypainter.com/index.ph...e=download.php by clicking "Start Array Painter... " and tell me if you get your version of java updated automatically.
Any respons is appreciated.
Thx.
FlashKit > Flash Help > Flash General Help
Posted on: 11-07-2005, 04:11 PM
View Complete Forum Thread with Replies
Sponsored Links:
Test If Array's Element Is An Array.
I'm recursively looking through an Array, and I'm looking for a solid way to test if an element is actually an Array(there is a chance that the tested array element is another datatype). I was thinking that I could use the length property to test, however looking in the index of ASDG2 I see that there are a few other Objects that possess the a length property, and I am afraid that this might cause a problem.
look at
nav_array[i].length >= 1
below
Is there a way to use typeof on an Array, and have it return anything other than Object?
Code:
private function recurseThroughArray(nav_array, itemsArray, depthHolder){
for(var i=0;i<nav_array.length;i++){
depthHolder.push(i);
if(nav_array[i] == itemsArray){
var returnDepth:Array = depthHolder;
break;
}else{
if(nav_array[i].length >= 1){ //make sure that this is an Array
recurseThroughArray(nav_array[i], itemsArray, depthHolder);
}else{
depthHolder.splice(depthHolder.length-1,1);
}
}
}
return returnDepth;
}
also, I'm new to recursion, and I haven't tested this yet.
View Replies !
View Related
Painter Program
Hey, i was messin around with AS the other day and made http://phildman14.homeip.net/flash/paint.html . Then i got this idea to be able to save what you drew and call it up later. After maybe 30 min of changes in my previous code i got http://phildman14.homeip.net/flash/paintsaver.html and its decoder: http://phildman14.homeip.net/flash/paintopener.html . Right now its just copy and paste (Ill work on a php saver app later) But the question im trying to get to is: Are there any suggestions on how to make the lines ACTUALLY connect rather than having to move the mouse slowly? One friend had the idea to have the dot expand, but thats just having bigger dots. Any help with this would be greatly appreciated
View Replies !
View Related
Dynamic Painter
Have a project where I'm going to have to change the mouse into a paintbrush, then have it leave a trail as you move the mouse. This would occur regardless if you press down on the mouse or not. After a bit of time, the trail would begin to dissolve. Anyone see anything like this before? I can easily script out the painting portion, it's just the dissolving aspect that's tricky.
Thanks!
Ryan
View Replies !
View Related
Flash Painter
I am trying to make my own flash painter. I was able to make a pencil for my pointer, the pencil draws black. I was able to make a masked area so the strokes could only go in that area where my picture is. I make pallet buttons red, blue, etc. and 4 stroke size buttons. Now I'm stuck. I'm reading Learning ActionScript 2.0 for macromedia flash 8. I've looked all over the internet but I cannot figure out how to make each individual buttons change stroke or color. Does anyone know where I can find some basic examples to do this? Any ideas? I would like to post the fla as an attachment but I can't it's telling me the file is too big. New to this forum
View Replies !
View Related
Hit Test In Array?
Is it possible to do some code like this in an array instead?
code:
if (_root.hit.hit0.hitTest(_root.hero)) {
scroll = "false";
}else if (_root.hit.hit1.hitTest(_root.hero)) {
scroll = "false";
}else if (_root.hit.hit2.hitTest(_root.hero)) {
scroll = "false";
}else if (_root.hit.hit3.hitTest(_root.hero)) {
scroll = "false";
}else if (_root.hit.hit4.hitTest(_root.hero)) {
scroll = "false";
}else if (_root.hit.hit5.hitTest(_root.hero)) {
scroll = "false";
...
I tried without succeeding ... thought you guys could help.
View Replies !
View Related
Test If Value Is In Array
Hi
Does ActionScript have a function similar to PHP's in_array()?
I have an isometric grid game where a character can walk around a certain area but certain grid squares are holes. I have the grid coordinates for all the squares in an array and I wanted to check the
array to see if the character is standing on solid ground or over a hole. So basically if the current position exists in the array ...carry on....if the position does not exist in the array....play falling down animation.
I can think of a few alternative ways of doing this, but an in_array function would make life so much sweeter!
View Replies !
View Related
Using An Array To Hit Test
Hello, I'm making a game where enemies (beans in this case) generate off a timer and run across the screen. The aim is to hit them with a big fork to kill them (controlled by the keyboard).
The bean enemies are all instances of the same movie clip, so I added them to an array called beanGroup. When I hitTest with the code I have at the moment, it throws up a run time error:
Error #2007: Parameter hitTestObject must be non-null.
The idea was to place the instance names in an array, then access them through a hitTest. However, it is becoming problematic to reference the names from the array back to the actual instances that placed them there. Can anybody figure out what solution may be required?
The Code:
Please note: I have removed some of it to make it easier to read.
PHP Code:
var beanGroup:Array = new Array();
var beanNumber:Number = 0;
function addBean(event:TimerEvent):void
{
bean = new mcBean();
addChild(bean);
bean.name = "bean"+beanNumber;
beanGroup.push("bean"+beanNumber);
beanNumber++;
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, moveFork);
function moveFork(evt:KeyboardEvent):void
{
switch (evt.keyCode) {
case Keyboard.DOWN :
forkInstance.y += yFork;
for ( var i:int = beanGroup.length -1; i >= 0; i--)
{
if(forkInstance.hitTestObject(beanGroup[i] as DisplayObject)){
trace ("bean killed");
}
}
}
View Replies !
View Related
Test For A Value In An Array
Hi,
How do I test if a value is already in my array? I am pulling random data from an XML file and displaying it. I have a variable "rand" that I write to an array wihtin my loop of 3 iterations. But how do I test to see if the current rand is already in the array, and if so, generate rand again. Here's what I got so far:
Code:
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.load("dynamic-content.xml");
myPhoto.onLoad = function(success) {
numimages = this.firstChild.childNodes.length;
//create an array to hold the random numbers I've used so far
used = new Array();
//set image spacing
spacing = 100;
for (i=0; i<3; i++) {
//generates a random nuber within the number of entries in my xml file
num = (Math.random()*(numimages-1));
rand = Math.round(num);
//add the current rand to the 'used' array
j = used.length;
used[j] = rand;
trace(used);
//sets the random number entry of the xml file (and it's data) to picHolder
picHolder = this.firstChild.childNodes[rand];
thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
thumbHolder._y = i*spacing;
//displays the text and image
_root["title"+i].text = picHolder.attributes.title;
_root["text"+i].text = picHolder.attributes.desc;
_root["loader"+i].loadMovie(picHolder.attributes.thmb);
}
};
View Replies !
View Related
Hit Test Using Array
I am in the process of making a jigsaw game. For testing purposes, it is only a 4 piece, square puzzle. I have 4 seperate movie clips named one, two, three, and four.
I wanted to make it different than the other jigsaw puzzles I've seen in flash, and wanted to make it so that when you 'connect' pieces that go next to each other, they actually follow each other.
In each movie clip I have :
PHP Code:
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
this.stopDrag();
}
There is only one frame, and on the first frame's actions I have :
PHP Code:
stop ();
_root.one.onEnterFrame = function () {
if (_root.one.hitTest(_root.two)) {
xposition1 = getProperty("/one", _x);
yposition1 = getProperty("/one", _y);
setProperty(/two, _x, _root.one._x + 205);
setProperty(/two, _y, yposition1);
}
}
That code all works just fine ( I know I can clean it up a little, but I am not concered with neatness just yet. Once it is done I will clean up the code). What I am trying to do though is make it so that I can create an array and have it loop for the function of each movie clip. I have this code, yet don't know exactly how to implement it:
PHP Code:
myArray = ["one", "two", "three", "four"];
for (j=0; j < myArray.length; j++) {
blah += myArray[j];
What I want is when a MC checks for a hitTest, I want a function for it to test which other MC it hit, rather than listing them each individually like in the first code snippet I showed. I don't want to code for each instance, though I will, I just wondered if there's a way to to do it with Arrays.
I am attaching a copy of the fla i've been workin on. Thanks so much. Heck, if theres a better way to do it too, let me know!
View Replies !
View Related
How To Make A Painter In Flash?
I mean, How to make a paint software in flash, which you
can take (chosse)a pen or pencil and chossing a colors and free draw on the stage, like the paint software of microsoft, usually located at: START -->Programs-->accessories-->Paint.
Understood? (I can try to explain it again in other way)
View Replies !
View Related
Corel Painter 9 Tutorial
Hi, apologize for posting about another program in here, but I'm not sure where else to post this. Does anyone know of any good online tutorials for Painter, or another message board to ask this question?
Thanks in advance
View Replies !
View Related
Using An Array To Hit Test Enemies
Hello, I'm making a game where enemies (beans in this case) generate off a timer and run across the screen. The aim is to hit them with a big fork to kill them (controlled by the keyboard).
The bean enemies are all instances of the same movie clip, so I added them to an array called beanGroup. When I hitTest with the code I have at the moment, it throws up a run time error:
Error #2007: Parameter hitTestObject must be non-null.
The idea was to place the instance names in an array, then access them through a hitTest. However, it is becoming problematic to reference the names from the array back to the actual instances that placed them there. Can anybody figure out what solution may be required?
The Code:
Please note: I have removed some of it to make it easier to read.
PHP Code:
var beanGroup:Array = new Array();
var beanNumber:Number = 0;
function addBean(event:TimerEvent):void
{
bean = new mcBean();
addChild(bean);
bean.name = "bean"+beanNumber;
beanGroup.push("bean"+beanNumber);
beanNumber++;
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, moveFork);
function moveFork(evt:KeyboardEvent):void
{
switch (evt.keyCode) {
case Keyboard.DOWN :
forkInstance.y += yFork;
for ( var i:int = beanGroup.length -1; i >= 0; i--)
{
if(forkInstance.hitTestObject(beanGroup[i] as DisplayObject)){
trace ("bean killed");
}
}
}
View Replies !
View Related
Using An Array To Hit Test Enemies
Hello, I'm making a game where enemies (beans in this case) generate off a timer and run across the screen. The aim is to hit them with a big fork to kill them (controlled by the keyboard).
The bean enemies are all instances of the same movie clip, so I added them to an array called beanGroup. When I hitTest with the code I have at the moment, it throws up a run time error:
Error #2007: Parameter hitTestObject must be non-null.
The idea was to place the instance names in an array, then access them through a hitTest. However, it is becoming problematic to reference the names from the array back to the actual instances that placed them there. Can anybody figure out what solution may be required?
The Code:
Please note: I have removed some of it to make it easier to read.
PHP Code:
var beanGroup:Array = new Array(); var beanNumber:Number = 0; function addBean(event:TimerEvent):void { bean = new mcBean(); addChild(bean); bean.name = "bean"+beanNumber; beanGroup.push("bean"+beanNumber); beanNumber++; } stage.addEventListener(KeyboardEvent.KEY_DOWN, moveFork); function moveFork(evt:KeyboardEvent):void { switch (evt.keyCode) { case Keyboard.DOWN : forkInstance.y += yFork; for ( var i:int = beanGroup.length -1; i >= 0; i--) { if(forkInstance.hitTestObject(beanGroup[i] as DisplayObject)){ trace ("bean killed"); } } }
View Replies !
View Related
Array Hit Test With Mc(check This Out Its Diff.)
ok so what i am doing is makikng a game that u have a ship, it shoots lasers, and if a laser hits one of the many enemy ships that are shown, that ship blows up. I have the ship shooting the lasers, and the lasers hitting the enemy and having the laser dissapear, but i cant get the enemy ship to blow up (its a mc and i am moving it by a tween inside the movie clip, so it goes left and right) when they collide, i say this:
Code:
for (i=1; i<=10; i++) {
if (this.hitTest(_root["enemy"+i])) {
_root.spaceship.laserCounter--;
this.removeMovieClip();
_root["enemy"+i].gotoAndPlay(71);
}
}
and what happens is the laser disappears, (this is on the laser) but the movie clip of the enemy doesnt go and play line 71 , which is the explosion animation, in the enemy i have it so that the movment keeps looping by a go to and play 1, and right after that i have theexplosion animation, fram 71, but it never goes and plays it, can ne one help? (the laser counter is just keeping track of the lasers on the field so u can only have 4, but though sometimes itm akes it so u can only shoot 3, or 2, but dont matter that problem for later, now i cant figure out how to make it so the enemy goes to the explosion.) thank you so much.
View Replies !
View Related
Saving Drawning In Flash Painter Program
Ok, I just did a little flash painter program. Its a program in which you draw lines on the form. Now, i would like to be able to save those drawning. Is it possible. Can i save them in a known format like jpg or bmp? If not, can i only save them as a unknown format and then be able to load them after in the program? If yes how?
View Replies !
View Related
Saving Drawnings In My Flash Painter Program
Ok, I just did a little flash painter program. Its a program in which you draw lines on the form. Now, i would like to be able to save those drawning. Is it possible. Can i save them in a known format like jpg or bmp? If not, can i only save them as a unknown format and then be able to load them after in the program? If yes how?
View Replies !
View Related
Saving Drawning In My Flash Painter Program
Ok, I just did a little flash painter program. Its a program in which you draw lines on the form. Now, i would like to be able to save those drawning. Is it possible. Can i save them in a known format like jpg or bmp? If not, can i only save them as a unknown format and then be able to load them after in the program? If yes how?
View Replies !
View Related
Looking For A Full Flash Website Template For A Painter
Hello,
I'm looking for a full flash website template which could be used for a painter website (No. It is not Picasso )
Can you help me to find a place in which I can purchase that kind of a template?
I've tried the Actionscript forum but got a message that it wasn't the right forum. I hope this one is more appropriate.
Thanks in advance,
David
View Replies !
View Related
Test Wether Functionparameter Is Number, Array, Or Certain Object
Hello
I need a function that tests what type of parameters were passed to it. Something like this:
function test (parameter)
{
if (parameter==typeof(number)) DoSomething;
else if (parameter==typeof(Array)) DoSomethingElse;
else if (parameter==typeof(Object:Test)) DoSomethingDifferent;
else if (parameter==typeof(Object:Two)) DoSomethingcompletlyDifferent;
else DoNothing;
}
View Replies !
View Related
Test Array For Numerical Order, Return True
I've got this function:
ActionScript Code:
function sfrCM() {
for (var j= 0; j<oH.length; j++) {
if ((oH[j]>oH[j+1]) && (oH[i+1] != undefined)) {
hS = false;
trace("no");
} else {
hS = true;
trace("yes");
}
}
}
but it doesn't trace anything so obviously it's messed up somehow.
basically I'm just trying to see if the five numbers in the array oH are in consecutive order, and if so, return hS = true;
so not compare the [i] placement, but set the numbers in the array equal to real numbers so that I can compare those and see if they are in consecutive numerical order
there are five numbers though, and I think even if it worked properly, what I've got would only check if the first two array elements were consecutive, but I want all five...
View Replies !
View Related
Flash 8 Quiz Guru Needed: Make Link Appear For Next Test Only If Test Taker Passes.
Greeings, all,
Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am forgetting. The test taker makes their selection(s) or answers, and clicks a "check answer" button. They then get a feedback statements depending on whether they have answered correctly or not. Many questions involve multiple selections to be correct, but all must click on the "check answer" button to advance to the next question.
The point is that all of this functionality is coded in the component(s) which make the template so versatile. A copy of my .fla shouldn't actually be needed (I am guessing here), because the component code is what I believe needs tweaking, at least the part where the final percentage of correct answers is calculated at the end of the test, and that percentage is compared to a user-defined passing percentage score.
I think this requires a Flash Quiz Guru, who knows just how to connect the pass or fail result to a new button or a "go to" redirect. I don't know whether the same effect could be accomplished by frame scripting, but I expect tweaking the component(s) code would seem a more direct approach.
I cannot fill in the blanks for any idea that is just an idea. If anyone can code this, make it work and test it, and direct me to where the snippets must be placed, I would be deeply grateful. This is about education, not a game or commercial razz-ma-tazz.
Are there any Flash Quiz Guru's who can help me out with this?
Thank you.
regards,
stevenjs
____________________________________
"I am but an egg."
--Stranger in a Strange Land
View Replies !
View Related
Flash Quiz Guru Needed: Make Link Appear For Next Test Only If Test Taker Passes.
Greeings, all,
Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am forgetting. The test taker makes their selection(s) or answers, and clicks a "check answer" button. They then get a feedback statements depending on whether they have answered correctly or not. Many questions involve multiple selections to be correct, but all must click on the "check answer" button to advance to the next question.
The point is that all of this functionality is coded in the component(s) which make the template so versatile. A copy of my .fla shouldn't actually be needed (I am guessing here), because the component code is what I believe needs tweaking, at least the part where the final percentage of correct answers is calculated at the end of the test, and that percentage is compared to a user-defined passing percentage score.
I think this requires a Flash Quiz Guru, who knows just how to connect the pass or fail result to a new button or a "go to" redirect. I don't know whether the same effect could be accomplished by frame scripting, but I expect tweaking the component(s) code would seem a more direct approach.
I cannot fill in the blanks for any idea that is just an idea. If anyone can code this, make it work and test it, and direct me to where the snippets must be placed, I would be deeply grateful. This is about education, not a game or commercial razz-ma-tazz.
Are there any Flash Quiz Guru's who can help me out with this?
Thank you.
regards,
stevenjs
____________________________________
"I am but an egg."
--Stranger in a Strange Land
View Replies !
View Related
Flash Quiz Guru Needed: Make Link Appear For Next Test Only If Test Taker Passes.
Greeings, all,
Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am forgetting. The test taker makes their selection(s) or answers, and clicks a "check answer" button. They then get a feedback statements depending on whether they have answered correctly or not. Many questions involve multiple selections to be correct, but all must click on the "check answer" button to advance to the next question.
The point is that all of this functionality is coded in the component(s) which make the template so versatile. A copy of my .fla shouldn't actually be needed (I am guessing here), because the component code is what I believe needs tweaking, at least the part where the final percentage of correct answers is calculated at the end of the test, and that percentage is compared to a user-defined passing percentage score.
I think this requires a Flash Quiz Guru, who knows just how to connect the pass or fail result to a new button or a "go to" redirect. I don't know whether the same effect could be accomplished by frame scripting, but I expect tweaking the component(s) code would seem a more direct approach.
I cannot fill in the blanks for any idea that is just an idea. If anyone can code this, make it work and test it, and direct me to where the snippets must be placed, I would be deeply grateful. This is about education, not a game or commercial razz-ma-tazz.
Are there any Flash Quiz Guru's who can help me out with this?
Thank you.
regards,
stevenjs
____________________________________
"I am but an egg."
--Stranger in a Strange Land
View Replies !
View Related
(Authoring Mode-test Scene-test Movie )Different Results WHY?
(Authoring mode-test scene-test movie )Different results WHY?I will get mad working on a quiz for a month plz help: im working on quiz game -frame by frame- its 15 scenes each scene contain about 70 frames with 70 action script :go to and stop - go to and play - stop every thing is fine till scene No. 11 in the authoring mode when choose from control menue enable simple buttons - enable simple frame action : its working fine scripts executed fine but when going to test movie mode some scripts doesnt work WHY? what mistakes i have done? what should i do ? how can a void such a problem ? any suggestions PLZ??? Thanks in advanced
View Replies !
View Related
Loading Test File In To A Dynamic Test Box
i am making a flash app and part of it is being able to enter the name of a text file in an input text box and hit a button and if there is a text file with the name you entered in the same folder as the swf it will load it in to the dynamic text box. attached Is a file of how far i got on my own.
thanks
View Replies !
View Related
How Do You Test Preloader In Test Movie?
hey... another question...
how do i test my preloader in the Test Movie?
when i use Test Movie the file is already 100% loaded so i dont know if my preloader is workin or not. is posting it in the web the only way to test if the preloader is working? thanx in advance. peace and prayer
alex
View Replies !
View Related
Test Scene Vs. Test Movie
Whenever I have done work in flash, these two commands have always worked the same. However, this one time, I test scene and the thing works exactly as I would like it to. When I test movie, one of my movie clips doesn't show. I can not find any problems in the code, and the layers all seem right, does anyone know of a difference between these so that I can look for a different problem? I have been racking my brain and the brains of others for about a week now on this. Thank you for any help.
Steve
View Replies !
View Related
Test Scene Vs. Test Movie
I have Scene 1 as a loader, and Scene 2 as my movie...
when I "test scene" for Scene 2 the quality looks great!
but when I "test movie", my Scene 2 movie looks like crap!
Anyone know why!? I went to "publish settings" and put all my settings at highest quality possible. jpg's are at 100, and flash settings are all at 100 and best quality.
They are imported jpg's by the way. And look great until I export or even preview as a flash movie. (????)
Thanks.
View Replies !
View Related
[MX04] Diagonal Line Hit Test Or Drawn Line Hit Test
i have this guy who maves around and you can draw i gave it an instance name of "linesd" i dunno and i want to make it so the square will not go through the line that i draw in the swf. if you cant help with that can you help me with diagonal line hitTest i ban do vertical and horozontal ut diagonal is realy hard because it does the hitTest for the movie clip box not the line itself
-jakeA
View Replies !
View Related
Variables Help - Test.swf?one=test
I was wondering if anyone can help me, flash seems to be able to handle variables input from the browser ok
e.g.
http://www.tobeon.co.uk/test/test.swf?one=hello
however I don't know how to get it to accept variables for other levels
(example in link above I cant get the variable "two" in the movie "movie" to work)
things like _level0.one=hello and _level0.movie.two=hello doesn't seem to work
any help it is v important?
Thanks in advance
View Replies !
View Related
"Test Scene" Acting Differnet Than "Test Movie"
I am trying to build a cartoon. I am going through allot of pain staking measures to sync up stuff. It is behaving (mouths and sounds) different in Test Scene, than Test Movie. I am using 20 fps. Is that a good idea?
I am issing something major? This is making me nutz.
Any ideas?
Thanks,
: grey :
View Replies !
View Related
Array, Array HELP - Importing A External File Into N ARRAY - Almost There
I am reading and external file with the following code:
ActionScript Code:
on (release, keyPress "<Enter>") {
lv = new LoadVars();
lv.onLoad = function() {
questions1 = this.filelist0.split(",");
answers1 = this.filelist1.split(",");
for(i=0;i<questions1.length;i++)
//trace(questions1[i]+" "+answers1[i]);
trace(questions1[i]);
//assumes same number of scores in each list
};
lv.load("questions.txt");
}
When I parse the file it puts it into an columar format as it should...however I need it to look like this:
questions1=new Array ("2+4=?","What is the capital of Illinois?","What color is the sky?","10x(5+2)=?");
answers1=new Array ("8","springfield","blue","70");
How do I do that?
Text file look like this:
&questions1=2+4=?,What is the Capital of Illinois?,What color is the sky?,10x(5+2)=?")&
&answers1=8,springfield,blue,70&
View Replies !
View Related
Percentage Test Of A "Hit Test" ?
Hi all,
Ok, we can do hit test with movies and coordinates but, how can we test if two movie clips collide (for example a trashcan and a garbage) in more than 50% ?
I mean if the garbage fills more than 50% of the area of the trashcan how can i grab this ??
Any ideas ?
View Replies !
View Related
Array Text Into Textfield And Creating New Line For Each Array Element
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 field
I 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;
text = dropTarg1.join("/n");
}
}
All that is happening though is that the text field displays on a single line with /n in between each array element.
View Replies !
View Related
Calling A Function With An Array Variable As Arguments Is Resetting Array?
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!
Any help would be grateful.
ActionScript Code:
// processReplace Function function processReplace(transferFiles) { var processArray:Array = transferFiles.slice(); var fileName:String = new String(); var filesArray:Array = new Array(); var replaceArray:Array = new Array(); var exists:String = new String(); var error:String = new String(); var promptResult:String = new String(); // Check for (i=0; i<processArray.length; i++) { // This is where it bugs up <b>exists = processSearch(transferFiles[i][1]);</b> if (exists == "replace") { replaceArray.push(processArray[i]); } else { filesArray.push(processArray[i]); } } // Prompt if (replaceArray.length>0) { error = "Replace "+replaceArray.length+" item(s):
"; for (i=0; i<replaceArray.length; i++) { error += " - "+replaceArray[i][1]+"
"; } promptResult = mSystem.messageBox(error, "Replace Existing Files?", 4); } // Action if (promptResult == "NO") { transferFiles = filesArray; } else if (promptResult == "YES") { transferFiles = filesArray.concat(replaceArray); } processTransfer(transferFiles); }
The processSearch
ActionScript Code:
// == processSearch Function function processSearch(sentInfo) { for (i=0; i<_global.boxFiles.length; i++) { if (_global.boxFiles[i] == sentInfo[1]) { return "replace"; break; } } }
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
ANY Solution ideas are welcome, even if you think it's dumb
Thanks!
View Replies !
View Related
Array.splice Works But Array.slice Doesnt?
This should be simple enough. I have an array of objects, and I want to SLICE a piece of the array and assign it to a new array. All of my attempts have failed. SPLICE works, and I could duplicate my original array into a temp array and splice out what I want, but surely slice is supposed to save me this trouble, right?
I'm a bit baffled, but here's the code:
Code:
private function createGlist() {
var glistObj:Glist = this;
xml_object = new XML();
xml_object.ignoreWhite = true;
xml_object.onLoad = function(success:Boolean):Void {
if(success) {
var i:Number = 0;
for (var this_node = this.firstChild.firstChild; this_node != null; this_node = this_node.nextSibling) {
glistObj.thumb_array.push(new Gthumb(glistObj, glistObj.thumb_array_mc.getNextHighestDepth(), this.firstChild.childNodes[i]));
i++;
}
var load_start:Number = 2;
var load_count:Number = 2;
glistObj.thumb_load_array = glistObj.thumb_array.slice(load_start,load_count);
trace(glistObj.thumb_load_array); //no result, no error
trace(glistObj.thumb_array.slice(load_start,load_count)); //no result, no error
trace(glistObj.thumb_array.splice(load_start,load_count)); //outputs [object Object],[object Object]
} else {
//error
}
}
xml_object.load(xml_url);
}
View Replies !
View Related
Array Copy Points To Original Array Instead Of Duplicating
Hey all.
Spent a long time trying to figure out what was wrong with my code. Then I remembered about arrays being objects instead of primitive variables. My question is, how can I make a duplicate copy of an Array?
Details:
So this code
PHP Code:
package{
import flash.display.*
public class tester extends MovieClip{
var a:Array = [1,2]
public function tester () {
var b = a
trace (a)
b.splice(1,1)
trace (a)
}
}
}
results in this output:
PHP Code:
1,2
1
How can i make b an actual duplicate of a, instead of a pointer?
PHP Code:
b = new Array
b = a
doesn't work either.
Thanks!
DHP
View Replies !
View Related
Creating Multi-dimentional Array From Single Array
I have an array
myArray=[hello,bye,fred,1,2,3,4,5,6];
I need to convert it to a multi-dimentional array that would look something like below
array1=[hello,bye,fred];
array2=[1,2,3];
array3=[4,5,6];
newArray=[array1, array2,array3];
I am not sure how to split the array can anyone help? myArray.length/3 would give me the number in each of the new arrays but I am puzzled after this?
View Replies !
View Related
Associating Array Elements With Another Array Keeping The Order.
hi, i have already posted this problem yesterday but i haven't solved it yet.
i have two arrays:
array_1[a,b,c,d]
array_2[01,02,03,04]
the first array represents mcs in my stage - the buttons of the menu.
the second represents other mcs, containing some text.
when i rollOver each element of array_1 i would like to show each element of array_2 in the same order and hide it when i rollOver another menu button to show a new one.
I mean, it always has to be showing a with 01, b with 02, c with 03...
any suggestions?
View Replies !
View Related
Array Of Movie Loaders/array Of Image Files
Alright. I'm fairly new to Actionscripting, so if we can somewhat lame out the tech talk to mild to medium I'd appreciate it. what I am trying to do is create an swf movie that will interact with a PHP script. first lets start with saying the PHP script reads the directory that it is currently in and filters out any file that is not a GIF,PNG, or JPG and then it suffes all of this into a URL encoded string and the directory path ,such as :
?pictures=image1+image2+image3+image4&path=http://servername/directoryPath
now i have flash load the variables "pictures" and split the images and stuff those into an array and the directory path of course stays in its own seperate variable. ive gotten this far with no problems.
so what im trying to do now with this info is create a bit of a slide show. I want to take the array of pictures and load those into an empty movie clip displaying each picture consecutively. Ive made several attempts but no such luck. Ive tried to use a for() loop to cycle through the array of pictures loading them into the empty clip. im still very new and rather lost with these objects and class use i. Im sure im probably not using a listener of somesort that i need and what not. I am sorry i am probably not giving enough info for all this. the whole idea of this clip is to be able to display an indefinite amount pictures , so the flash player will not know ahead of time how many pictures till the php script has sent all the names of what is in the directory. this movie needs to be able to dynamically load any images that are in that directory.so any suggestions on what i can do with an array an an empty clip? thank you to anyone who can make suggesions.
View Replies !
View Related
How Do I Lope Through Array, Delete Clip And Remove From Array
I have a function that creates an instance of a movieClip and adds it to an array.
In my gameloop I loop through the array and change some values. Now I want a cleanup function that loops through the array, and if the y value exceeds a certain value, I want to delete the clip instance and remove the record in the Array.
Could someone please help me with the syntax for that? I will lay the code out below.
Thankyou
Attach Code
var myClipArray = new Array();
public function createClipInstance() {
var myClipInstance:myClip = new myClip();
myClipInstance.y = 0;
addChild( myClipInstance );
myClipArray.push(myClipInstance);
}
// loop through array and check y value
// if y > 400: Delete clip and remove from array
public function cleanClips() {
for (var n:int = 0; n<myClipArray.length; n++){
if (myClipArray[n].y > 400) {
// DELETE CLIP AND REMOVE FROM ARRAY
trace("this is where I need help");
}
}
}
View Replies !
View Related
Generate Random Value From Array 'excluding' The Current Array Value
getting my head round flash (sorta!)...
ok, nearly got this working; i have 11 movie clips on the root timeline and a empty controller movie. what i need to happen is for a random movie clip to play. when it reaches a point in it's own timeline, it sets the playNext variable to true and the controller movie clip works out the next random movie to play.
the problem comes when the controller 'randomly' picks the movie clip thats already playing! then the whole thing breaks...
is there a way that i can say 'generate me a random clip to play from this array 'excluding' the currently playing movie clip'?
any suggestions would be grand.
this is what i have on my controller clip:
onClipEvent (load) {
//define a new array
video_array = new Array();
//list each of the videos
video_array[0] = "zero";
video_array[1] = "one";
video_array[2] = "two";
video_array[3] = "three";
video_array[4] = "four";
video_array[5] = "five";
video_array[6] = "six";
video_array[7] = "seven";
video_array[8] = "eight";
video_array[9] = "nine";
video_array[10] = "ten";
//this is the count of how many elements (videos) are in your array
max = video_array.length;
//set the playNext to true
_root.playNext = true;
}
onClipEvent (enterFrame) {
//if playNext is true
if (_root.playNext) {
//generate a new random video to play
randomNumber = Math.floor(Math.random()*max);
//store the name
randomVideo = video_array[randomNumber];
//tell that video to play
_parent[randomVideo].gotoAndPlay(13);
//record the video we are playing
crntVideo = randomVideo;
//set playNext to false
_root.playNext = false;
}
}
View Replies !
View Related
Load Xml Images-->Array-->Duplicate Array: AHAA
Hello Kirupians!
[Summary]
I want to load images from an XML, then store the images inside an array, then duplicate that array into other clone arrays so that I can addChild() copies of the images into stage whenever i want (and be able to change their properties).
Basicly i have to create two duplicates; big_img and icon_image
[SYMPTOMS]
Everything is loaded fine;the big_imgloads and positions correctly, but, when i try to load icon_image the first big_img disappears! as if the new array has hasn't duplicated the original array (as if it's only a shortcut, not a real copy).
The cody thing:
ActionScript Code:
// total images read from XMLvar axiLength=Accessoir.length();// main image container arrayvar axxARR:Array = new Array();// add images to arrayfor (var k=0; k<axiLength; k++) { var axxLoader:Loader = new Loader(); axxLoader.load(new URLRequest(Accessoir.PHOTO.text()[k])); axxARR.push(axxLoader); axxLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, axxLoaded);}function axxLoaded(e:Event):void { // show big image if (axiLength==axxARR.length) { axxShow(0); }}function axxShow(ID_AXX:Number) { // duplicate images array var axxImage:Array=axxARR.concat(axxARR); // reposition it axxImage[ID_AXX].x = product_details_swf.axx.x+(axxImage[ID_AXX].width/2)-5.5; // Add init image to accessoires axxImage[ID_AXX].name="axxImage"; product_details_swf.axx.addChild(axxImage[ID_AXX]);}// here i got an event listner to a button, once rolle over is triged it // should make small copies of the whole array images and put them on stage//....function rollover_button(ID_AXX:Number) { for (var i=0; i<axiLength; i++) { axxCreate(i); } function axxCreate(ID_AXX:Number) { var axxPic:Array=axxARR.concat(); imageResizer(axxPic[ID_AXX], 50, 50); axxPic[ID_AXX].name="axxPic_"+ID_AXX; axxPic[ID_AXX].x=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).x+axxPicSpacingX; axxPic[ID_AXX].y=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).y+axxPicSpacingY; product_details_swf.axx.addChild(axxPic[ID_AXX]); }}
[MORE INFORMATION]
I tried array duplication using; concat and slice but not work, it doesn't creat copies of the orriginal array, but just a shortcut to it!
thanx for any tips!
View Replies !
View Related
|