ActionScript 2.0 :: Using Array And For Loop To Duplicate Process

Aug 5, 2006

I've got 4 menubuttons: homeBut, aboutBut, portBut and contBut that I'm adding a rollover command to. If I write all of it out as below it works correctly. Obviously this isn't the way to do it so I've used an array and for loop to duplicate this process. However, when I compile the .fla the rollovers don't work. I thought I had my head around loops, vars and arrays but apparently not.

Below is the bloated, redundant code that works followed by the array/loop code that doesn't.
// Main Menu: Rollover
/*this.menuMC.homeBut.onRollOver = this.menuMC.homeBut.onDragOver = function() {
this._parent.homeTxt.gotoAndStop("on"); };
this.menuMC.aboutBut.onRollOver = this.menuMC.aboutBut.onDragOver = function() {
this._parent.aboutTxt.gotoAndStop("on");
[Code] .....

View 2 Replies


Similar Posts:


AS3 :: Flex - Show The Current ProgressBar Value Of Process Within A Loop?

Apr 26, 2011

I dont know how to show the current progress in progressBar component when the process is a loop that requires a lot of seconds to do the job. Inside the loop, i setProgress and update the progressBar label in every cicle, but it is not shown up to the job is done. I dont need this, because i want to see the advance of process.

View 2 Replies

ActionScript 3.0 :: Cloning Array - Get Back An Object Rather The Exact Duplicate Of The Array Itself

Jul 7, 2010

I have been trying for an hour to clone an array, It seems that nobody has a true reference on how to do it. Two arrays - movieClipArray 1 and movieClipArray2 I want to duplicate movieClipArray1 entirely so that when I addChild(movieClipArray2[0]), it doesn't take away from movieClipArray1 or reference it in any way.

[Code]...

View 3 Replies

ActionScript 2.0 :: Get The For Loop To Duplicate The Clips?

Feb 29, 2004

I'm trying to make a bit stream across my page when you mouseover a button. The bit stream can be quite long, so I wouldn't think to do it by hand. I'm wondering how I would go about making the stream start out, and how I can get each bit to follow the other right behind it. (They're about 10 pixels wide) I can get the for loop to duplicate the clips, but I can't seem to get them in order.

View 5 Replies

ActionScript 2.0 :: Duplicate Text Field From Loop?

Mar 27, 2008

i have a loop calling in the length from a xml file, how can i duplicate the text field, since this function does not exist?

for (var j:Number = 0; j<=section[0].nTitle.length; j++) {
this.createEmptyMovieClip("mNav",this.getNextHighe stDepth());
mNav.createTextField("tSub",this.getNextHighestDep th(),100,100,100,20);//places it at x:0 y:0 size 100x20 pixels

[Code].....

View 1 Replies

ActionScript 2.0 :: Using A Loop To Duplicate And Random X Position?

Oct 5, 2007

got some code working to duplicate a movieclip, but what I'd really like to do is obviously randomise the movieclip's x position so that it spreads across the stage, rather than stacking in the same position as it is now.

Code:
for (i=1; i<11; i++){
duplicateMovieClip("alien", "alien_new_"+i, 22-10, i);
}

View 4 Replies

ActionScript 2.0 :: Using A Loop To Duplicate A MC Named MCbutton?

Feb 18, 2004

I'm using a loop to duplicate a MC named MCbutton, which is all good.

[AS]
for (i=1; i<=this.total; i++) {_root.MCbutton.duplicateMovieClip(["MCtest"+i], 1+i);
trace(_root.MCtest1);

[Code]....

Can't i duplicate a Clip inside another Clip??

View 5 Replies

ActionScript 2.0 :: Loop With XML - Duplicate Some Main Button MovieClips For Each <dept> Node

Aug 25, 2004

What Im trying to do is duplicate some main button movieClips for each <dept> node. When pressed these main buttons then show a second set of buttons for as many <menu> nodes there are. In the actionScript the displayMainButtons function is used to loop through the XML and display the Main buttons. With the other 2 display functions (displayFirstButton and displaySecondButton) Im displaying another button for each <menu> node. These too works just fine, but the problem with writing it this way is that I have to write another display function for as many <dept> nodes there are. Id like this to be written so it loops through it in one function so I can add as many <dept> nodes with as many <menu> nodes as I'd like without going back into the AS code to add more display functions. And as you can see, I had to do the same to delete the buttons.

View 1 Replies

IDE :: Removing Duplicate Value In An Array?

Oct 26, 2009

I have an array containing single alphabet in every index and some of them in the array are duplicates. I'm trying to pick an alphabet and if there is an alphabet in that array, I want it remove from the array.

so lets say if i have 3 "a" in the array, I want all 3 to be remove. But my function only remove one alphabet. How do i make it remove all 3?

Also another question is, if i reach the end of the array how to i remove it? if i use splice it doesnt seem that it will remove the last item in the array.

my code is very simple

for (var i:int = 0; i<alphabetArrayLength; i++) {
if (singleAlphabet_arr[i] == alphabetPicked) {
answer = singleAlphabet_arr.splice(i,1);
}
}

View 1 Replies

ActionScript 3.0 :: Removing Duplicate Value In An Array?

Oct 26, 2009

I have an array containing single alphabet in every index and some of them in the array are duplicates. I'm trying to pick an alphabet and if there is an alphabet in that array, I want it remove from the array. so lets say if i have 3 "a" in the array, I want all 3 to be remove. But my function only remove one alphabet. How do i make it remove all 3? (var i:int = 0; i<alphabetArrayLength; i++) { if (singleAlphabet_arr[i] == alphabetPicked) { answer = singleAlphabet_arr.splice(i,1); } }

View 7 Replies

ActionScript 3.0 :: Duplicate An Array And Then Push It Into Itself?

May 4, 2011

way to duplicate an array and then push it into itself?
 
Do I need to use concat or is there a way I can keep the original array ?

View 11 Replies

ActionScript 3.0 :: Duplicate Sprites From Array?

Mar 19, 2012

I'm having one of those brain cramp days..I'm trying to add a number of items (sprites) from an array to the stage. There are 5 items in the array, and I want to randomly pick one of them, add it to the stage, and do this 100 times.My end result only has 5 items. I can see why, because when I try to add the same item again, it replaces the previous placed item. I can't think of how to duplicate the item in the array to add as a new Sprite

ActionScript Code:
private var sizes:Array = new Array(15,10,5,20,30);
private var squares:Array = new Array(); // becomes populated with square sprites the sizes

[code].....

View 9 Replies

ActionScript 3.0 :: Remove Duplicate Array Values?

Mar 10, 2009

I'm trying to use a for loop to remove duplicate array values. I've tried pop, shift, and splice.

View 3 Replies

ActionScript 1/2 :: Remove Duplicate Objects In Array?

Jul 9, 2009

This doesn't work at all.[code]...

but adding "removeDuplicates(aPeople);" after "createfile(thename);" has no effect: in other words, when I push the savefile button, it keeps creating clones of the same objects. What can I do?

View 2 Replies

ActionScript 3.0 :: Merging Duplicate Data In Array

Jan 31, 2009

I am parsing data from an xml file into an array within my flash file. The nodes within the xml file have common data between them. What I am attempting to do is dynamically push the data in the array without duplicating data already contained in the array. For example I may have an xml file that looks like this:

<videos>
<video>
<title>video1</title>
<thumb>file1.jpg</thumb>
<group>group1</group>
[Code] .....

Say I want to push the "group" data into an array. When it gets to the third "video" node I want the array to see that "group1" already exists so instead of pushing a second reference of it into the array to actually push the secondary data ("title" and "thumb"> into a new array for "group1". I will later use that array to pull up a list of "group1" videos.

View 2 Replies

ActionScript 2.0 :: Delete The Duplicate Item From An Array?

Aug 10, 2009

I am working on a project where there are 10 questions and user can answer the question or skip the questions. I want to track the number of questions (which questions) the users have skipped. I am adding the skipped questions in an Array. But if users click on the previous button and skips the same question again, the same question number is added twice to the skipped question Array.My Array looks like:skippedQuestionsArray(1,2,3,4,2,3,4,1);I simply want to trip the duplicate entry and get the output likeskippedQuestionsArray(1,2,3,4);

View 6 Replies

ActionScript 3.0 :: Duplicate MovieClip Based On Xml Array

Jan 21, 2010

I have a xml file in which I'm pulling in a thumbnail image into a array and I'm trying to populate a moveclip and then duplicate it accordingly below it with correct spacing

heres the code I have:

ActionScript Code:
var thumbs:Array = new Array();
var myXML:XML;
var myLoader:URLLoader = new URLLoader();

[Code].....

View 2 Replies

ActionScript 2.0 :: Duplicate Values Being Pushed Into The Array?

Mar 23, 2010

I'm calling a flash file into the VB application. I'm also executing some code when user clicks on the SWF file.

Pushing a value into an Array is part of the code. What is happening is that.....when i trace the value of the Array, it shows duplicate values.

like if i'm pushing string "A" into the Array......when i trace the array it shows the array as [A,A] with length 2.

ActionScript Code:
if((second_mouse).hitTest(First_random_box))
{
Mouse_Team_One = ID;

[Code].....

View 0 Replies

ActionScript 2.0 :: Duplicate / Create Objects With Array?

Oct 31, 2010

I am planning to create Dynamic Boxes, in which may contain buttons, pictures and textboxes in the box. but I'd really want to know are

When a duplicated Movieclip was clicked, I want it to return a value so which I can know what Movieclip was clicked.

How do I manage them in one duplicated movieclip? for example, A duplicated box, and then in that box is an image, textbox and a button MOVIECLIPS, so when dragged, they can be dragged also.

View 0 Replies

ActionScript 3.0 :: Delete Duplicate Entries In An Array?

Jul 28, 2011

I want to delete the duplicate entries in an array. So I have tried the code I atach to this post. I have proved all the posible combinations but no one seems to work.This is the code I have writen:

Code:
package
{

[code].....

View 5 Replies

ActionScript 2.0 :: Remove Duplicate Item From An Array?

Aug 10, 2009

I am working on a project where there are 10 questions and user can answer the question or skip the questions. I want to track the number of questions (which questions) the users have skipped. I am adding the skipped questions in an Array. But if users click on the previous button and skips the same question again, the same question number is added twice to the skipped question Array. Is there any solution so that I could delete the duplicate entry in an Array.My Array looks like:skippedQuestionsArray(1,2,3,4,2,3,4,1);I simply want to trip the duplicate entry and get the output likeskippedQuestionsArray(1,2,3,4);

View 10 Replies

ActionScript 3.0 :: Getting Rid Of Duplicate Items In A Multidimensional Array?

Feb 5, 2010

I'm having trouble going through a multidimensional array and weeding out duplicate items. For instance, here is some simple code:

Code:
var arr1:Array=new Array(1,2,3)
var arr2:Array=new Array(2,3,4)
var arr3:Array=new Array(arr1,arr2)
var arr4:Array=new Array(1,2,3)

[code]....

Is there an error in my logic? Or programming? Or is there a different way I would have to go about comparing array items than the array.some() method? My only other idea is to use a loop to go over every item individually in the nested array; is this the right track?

View 3 Replies

ActionScript 2.0 :: Search And Remove Duplicate And Consecutive Values In An Array?

Sep 25, 2005

I have an array which I am populating as I navigate through the site. Sometimes due to cicumstances apparently out of my control, I end up with two (never more) duplicate values consecutively placed in my array, here is an example:

groceries = ["bananas", "apples", "apples", "oranges"];

I need to run a script at all times that checks to see if this happens, and removes the second duplicate value, as well as it's corresponding key.How can I do this?

View 5 Replies

ActionScript 3.0 :: Duplicate Content Of One Array As Many Times Till Its Length Reaches Certain Value

Nov 1, 2009

i need to duplicate a content of one array as many times till its length reaches certain value.[code]

View 5 Replies

Actionscript 3 :: Sorting An Array To Avoid Neighboring Items Having Duplicate Attributes

Apr 21, 2011

I have an array of objects. Each object has a color attribute which could be "red", "blue", "yellow", "green", "orange" or "purple". There are 20-30 objects in the array so colors repeat. My goal is to sort the array so that no colors are next to each other. Distribution of colors is not exactly even but close.

This is what I have so far. It checks the next and previous object for a color match and if it finds a match it moves it to the end of the array.

private function sortColors():void
{
var getNext:uint;
var getPrev:uint;

[Code].....

This works OK but if there is more of a certain color they end up repeating at the end. I could add something to the end to throw those back into the mix but I feel like there must be a better way.

View 1 Replies

Loop Through An Array And Use The Array Value To Reference A Variable?

Sep 25, 2009

I want to loop through an array and use the array value to reference a variable.

The Setup:
(For illustration only. Not actual script)
My MCs:
triangle_mc
square_mc

[Code]....

View 1 Replies

ActionScript 2.0 :: For Loop To Check One Array Against Another Array?

Aug 25, 2011

ActionScript Code:
var answerArray:Array = ["3", "2", "5", "3", "2"]; //these are the correct answers
var answeredArray:Array = ["3", "1", "1", "3", "2"]; //this is an example of what the user

[code]....

View 3 Replies

ActionScript 2.0 :: When Click The Letter Movieclip It Does Create The Duplicate As It Should And It Starts To Drag The Duplicate Mc

Mar 20, 2010

My problem is that when I click the letter movieclip it does create the duplicate as it should and it starts to drag the duplicate mc. However, when I release the clip it doesn't stop dragging? I realized that if I put onMouseUP event instead of onRelease it actually does stop dragging when I release the mouse. I would, however not like to use the onMouseUP event if possible.

[Code]...

View 2 Replies

Actionscript 3 :: Duplicate AddEventListener Calls Create Duplicate Listener Entries?

May 4, 2010

If I have an object that calls

addEventListener(Event.ENTER_FRAME, update);
addEventListener(Event.ENTER_FRAME, update);

will that add 2 listeners?

View 2 Replies

Duplicate Symbol - Edit The Duplicate It Also Modifies What Is In The Original

Sep 26, 2000

I am having problems dupliating a movie clip. I can make a duplicate from an original but when I edit the duplicate it also modifies what is in the original. (I am just changing the text, thats the only difference between the 2) How come it effects both clips when I only change one?

View 6 Replies







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