ActionScript 3.0 :: Dynamic Navigation Bar - Tracing Index No Of Array

Jun 28, 2009

The Action script code below takes the strings in the array (pgtit) and creates a dynamic navigation bar I am trying to trace the index number of the array being click I just seem to get -1.

var pgtit:Array=["link1","link2","link3","link4"];
var xPos = 0;
var menuHolder:MovieClip = new MovieClip;
addChild(menuHolder);
for(var i:uint = 0; i < pgtit.length; i++){
var btn:MovieClip = new MovieClip();
[Code] .....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Tracing Array Index With XML And Getting -1?

Oct 30, 2009

I am working with a set of external XML data, and putting it into arrays. I have set up images and text on a page using XML data, which, when clicked on, will populate a popup window with XML data from the same index. For some reason, when I trace the index of the array, it comes up as -1.
 
stop();
itemNameTops1_txt.text = nme_array[0];
itemPriceTops1_txt.text = price_array[0];

[code]....

View 4 Replies

ActionScript 3.0 :: Tracing An Index Number From An Array?

Jun 27, 2009

I am trying to trace an index number from an array.

I know this must be about as simple as it gets, but I just cant figure it out.

I know the contents of the array are all asighned a number begining with 0.

I need to find out the index number of a thumbnail when you click on it.

Code:
function whenThumbsLoad(event:Event):void{
var thisThumbsLink:String = clipPathList[ c ];
var thisThumbsTitle:String = clipTitleList[ c ];

[Code].....

I know I can trace the thisThumbsLink and get that, but all I need is it's index number. Also I trace(c); and I get how many there are, but I just don't know what to trace to find the index number.

View 12 Replies

ActionScript 2.0 :: CS3 Tracing Current Array Index Position?

Apr 9, 2009

Is there any way of getting the current active index position from an array? As an example, something like this:

j=0;
current = myArray[index];
my_btn.onPress = function(){

[code].....

View 3 Replies

Actionscript 3 :: After Shuffling Array - Variable = Array[index] Gives 0, Trace(array[index]) Gives Correct Number

Aug 16, 2011

I think it would be simplest to explain it like this:

[Code]...

View 1 Replies

Flash :: Get The Specific Array Index Based On Value Inside The Index's Object?

Jun 22, 2011

So, for sending to individual streams we have to reference the connected netStream we want to send to in some way like this:

sendStream.peerStreams[0].send("MyFunction",param1,param2);

and I have to determine which peer I'm sending to by their ID such as "peerID1234"

I know that you can check the peerID of the stream by doing:

sendStream.peerStreams[0]["farID"]

how can I make my send stream function know to use the array index where the peerID is?

so basically it could be like:

sendStream.peerStreams[where peerStreams[]["farID"] == peerID].send("MyFunction",param1,param2);

View 1 Replies

ActionScript 3.0 :: TextField Navigation Index?

Oct 13, 2009

I'm new to ActionScript and I'm having trouble creating a navigational index for my company's catalog. I've created 6 dynamic TextFields on the stage, given each of them a unique instance name (one, two, three, etc.) and have assigned to each of them the same eventListener and pageJump function via AS. My intent is to allow a user to jump to a specific page by clicking on the corresponding TextField. My question is how do I tell the function which TextField has been clicked? Nothing I've tried has worked thus far. If there's

var navList:Array = new Array(one,two,three,four,five,six);
function setFieldParam():void {
var i:int = 0;

[code].....

View 1 Replies

ActionScript 3.0 :: Tracing An Object In An Array?

Aug 19, 2010

I have some simple Sprites that I'm putting into an array. However, when I click on them I want to trace what their position is in the array. How do I go about doing that?

ActionScript Code:
var myArray:Array = new Array();
var mySpriteOne:sprite = new Sprite();
mySpriteOne.graphics.beginFill(0x000000);

[Code]....

I want to add some mouse click listeners and then I want to trace the currentTarget's position in the array. I just have no idea what parameters to give the trace().

View 6 Replies

ActionScript 3.0 :: Tracing An Array Of Selected Movieclips?

Jan 29, 2012

I have 4 movieclips and I want to be able to track which one is selected or not, something like this:

I start with 4 unselected MC

I click on mc1 and a trace message says MC1 selected I click on mc1 again and a message says MC1 unselected I click on mc1 and a message says MC1 selected I click on mc2 and a message says MC1 and MC2 selected

I click on mc2 again and a message says MC1 selected and MC2 unselected

etc etc

I was looking at some arrays but I don't think I got the picture yet

View 3 Replies

ActionScript 2.0 :: Tracing Level Of Dynamic MC?

Nov 30, 2007

I am trying to create a dynamically generated MC with creatEmptyMovieClip(), and all works well. But looking the list of objects/variables in the show I can't seem to detect at what _level the clip is generated. I am using getNextHighestDepth() to set the level (see code below).

Ultimately what I am hoping to happen is that each successive MC will be generate OVER (or on the _level above) the existing MC. Currently it looks like the existing MC is replaced when the new MC is generated.

My next question would be (once I get this lot working) how do I then remove the MC that is under the newly generated MC. I imagine the RAM or processor wont mind if a few _levels of MCs are stacked up and this wont be running up more than about 20 _levels max. But for the purpose of best practice.

Code:
howImg_mc.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
howImg_mc.container_mc.attachMovie(newImg, "howImg", this.getNextHighestDepth());

View 1 Replies

ActionScript 3.0 :: Tracing An Array In MouseEvent Returns Undefined?

Feb 10, 2009

I have an 3 arrarys with names, if I trace them outside a MouseEvent it works fine, but as soon as I trace it inside a MouseEvent it returns as undefined.Here is my code:

ActionScript Code:
...
gallery["imageHolder_" + i].vote_btn.addEventListener(MouseEvent.CLICK, showVote);

[code]......

View 1 Replies

ActionScript 3.0 :: Array, Shuffle A Part Of An Array Using Start And End Index Is Not Working Properly?

Feb 15, 2011

I 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]...

View 8 Replies

ActionScript 3.0 :: Flash Ignores The Flash Index, And Focuses On Some Of The Navigation Elements Of The Parent?

Oct 6, 2009

I have a flash file that loads in a external swf. That swf contains a form that I want to control the tab order on. The external swf has form fields in it, and I have their tab indexes set. When I hit tab, flash ignores the flash index, and focuses on some of the navigation elements of the parent .swf. What am I doing wrong?

View 0 Replies

Way To Get Array Index

Sep 25, 2009

Is there a way to get the index of an array?

For instance, if I have an array:

buttons = Array("abc","def","ghi");

If I wanted to get the index dynamically of the string "ghi", could I do that with a certain function or piece of code?

View 1 Replies

AS3 :: Way To Array Index Naming

Mar 11, 2010

I thought that there was a way to be able to name array indexes. Like instead of myArray[0], it could be myArray["tileFour"]. I thought that instead of using index numbers one could use index words.

View 1 Replies

ActionScript 2.0 :: Get The Index Of An Array?

Sep 25, 2009

Is there a way to get the index of an array?

For instance, if I have an array:

buttons = Array("abc","def","ghi");

If I wanted to get the index dynamically of the string "ghi", could I do that with a certain function or piece of code?

View 0 Replies

ActionScript 3.0 :: Getting An Array's Index?

Jan 18, 2011

I have a game map made of tiles, each tile is stored in an array called _tiles.The very each tile has a "plantable" parameter, which determines whether or not something can be placed on it.Then i loop through the array and check the position of each its elements against the mosue cursor, so I know which tile am I hovering with my mouse.

And it works pretty good. The problem is that even though I know what is the position of the tile I'm having the cursor on, I still lack the knowledge of what index is that tile. I simply can't tell where exactly in the array is placed this tile. I just know its position. The reason why I want to know the index of it, is because it's the only way for me to set a proper flag, namely whether it's plantable or not. Here's the code:

ActionScript Code:
for(var j:int = 0; j < _tiles.length; j++)
{

[code]...

View 1 Replies

ActionScript 2.0 :: Way To Specify Index Of Array

May 18, 2005

Is there a way I could specify the index of a array using this short code:[code]How would I go about giving a custom index name instead of it being myArray[0]? I could do it the long way like posted below, but I was wondering the there was a way to shorten this:[code]

View 2 Replies

ActionScript 2.0 :: Go To The Next Index Of The Array?

Jan 18, 2007

i have an array of names that looks like this. var aNames:Array =new Array("jack","mike","Scott")

i have a text field called names which displays index 1 of the array.

and i have a button,when the button is pressed i want it to go to the next index of the array.

View 6 Replies

ActionScript 2.0 :: Any Way To Specify Array Index?

May 18, 2005

Is there a way I could specify the index of a array using this short code:
Code:
var myArray = new Array("teste");
How would I go about giving a custom index name instead of it being myArray[0]? I could do it the long way like posted below, but I was wondering the there was a way to shorten this:
Code:
var myArray = new Array();
myArray[myCustomIndex] = "testing";

View 2 Replies

ActionScript 3.0 :: Index Of Array In For-each Loop?

Jan 29, 2009

Consider an array with x number of elements (of type Object) where some of the elements might be undefined.I use a for-each loop to access all the elements of the array that is not undefined (since it simply skips the undefined elements).But I also want the index of that particular element.The only option I can see is to use indexOf(). But it feels a bit like looking for water on the other side of the river so to speak.

When looping through long arrays each frame, is there a change indexOf() might slow it down? or does the for-each loop somehow know what index it's dealing with?

View 19 Replies

ActionScript 3.0 :: Getting An Array Item By Index #?

Jun 15, 2011

I have a tricky problem in that I have an array that has been populated with strings ("item1", "item2", etc). However, at a certain point I need to pull one randomly out of the group, via a random number function. The issue is I cannot reference the items in the array by a number, I get an error. So when I try to get myArray(5) it doesn't work.
 
How can I work around this so I can grab a random item in my string array?

View 6 Replies

ActionScript 3.0 :: Push Value In Index 0 In Array?

Jan 18, 2012

I am creating a row which have 8 thumbnails in it, I save these in a array, When user drag row right to left then first Movieclip shift to last position, then i splice array 0 index and push to last position.. it  works fine but when i drag it left to right then I need to cut last index of array and i need to push on first position, but it is overwrite the last value of array and after push the value(myrow[0]=thumb) array showing it's length 7 before it was 8. What is the right way to push value at 0 index value

View 2 Replies

Actionscript 3 :: Array Remove By Index?

Apr 10, 2012

I have an array 'cat', 'dog', 'budgie'

and want to remove the item by index.

At the moment I have

function removeit(myindex) {
animals[myindex] = animals.pop()
}

View 1 Replies

Actionscript 3 :: How To Reset An Array Index

Feb 1, 2010

I got a problem with processing an array in actionScript. I removed the last element of an array through array.pop(). After that I would like to put this removed display-object back to the beginning of the array: array.unshift(object). The object is now the first element of the array but it got still its old label (number of the last element). Therefor I can't update the position (graphically) of the display object. Is it possible to "reindex" the array?

View 1 Replies

Actionscript 3 :: Know The Index Of An Item In The Array?

Mar 30, 2010

var arr1:Array = new Array();
arr1.push(item1);
arr1.push(item2);
arr1.push(item3);

then arr1 and its elements get passed to other functions is there a way to know the index of an item in the array?

GetParentArrayIndex(item2) would give me 1;

View 2 Replies

Actionscript :: Get Index Of Object In An Array?

Jan 29, 2012

I'm building a plugin and I'm using actionscript to save the selection of an object in an illustrator document and then reference it later.

var arrObj:Array=new Array();
arrObj.push(app.activeDocument.selection[0]);

If I select now the same object in the document and check if its in the array it returns a -1 for the index value.

var id:int=arrObj.indexOf(app.activeDocument.selection[0]);
trace (id); //-1

Why is the selection not considered the same object as in that of the array?

View 1 Replies

Actionscript 3 :: Undefined Index In Array?

Mar 29, 2012

I have my grid-array in my flash game that has a set sized index in it, and through some code it sometimes checks outside of the Array index. Is there a way I can check to see if a index slot is undefined/existent

Gives me a TypeError #1010
public function fnPopulate(X:int, Y:int, Grid:Array){
if (Grid[ X + 1 ][ Y + 1 ] != null || Grid[ X + 1 ][ Y + 1 ] != undefined ) {

[code]......

View 2 Replies

ActionScript 2.0 :: Get Index Of A Multidimensional Array?

Jun 30, 2009

I have an MD array:

var fitb:Array = new Array("question1","question2",[["answer1","t1"],["answer2","t2"],["answer3","t3"],["answer1","t4"]]);

It's for a quiz program. Question1 is the first part of the sentence, the answers words that are shuffled and question2 is the last part. So basically they have to align parts of a sentence in the correct order.

Everything is groovy, but I can't figure out how to check if the words are in the correct order. The current [2][0][1] position is my test for embedding the answers, but when it's shuffled it seems to ruin everything.[code]...

View 2 Replies

ActionScript 3.0 :: Add To Array Without Creating New Index?

Feb 3, 2010

How can I add to an array without creating empty values.. the indexes are id'
So I cannot use push..

Or is there a way to remove associative array indexes? I cannot get it to work with splice...

ActionScript Code:
var test:Array = new Array(1,2,3);
trace('before splice:' + test.length);

[Code]....

View 2 Replies







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