ActionScript 2.0 :: Using Array To Reference Button Number?

Aug 18, 2010

I have an array for my navigation bar (btn1, btn2, btn3 etc) where when the user clicks on a button, it goes to the correct page, and all is good. Now, I when the user clicks on a page, I want it to play a funtion where the button (movieclip) goes to frame2, and the button is disabled. How do I say 'if user clicks btn1, and is on page1, now disable btn1'. My code is below:

PHP Code:

myArray = ["btn1", "btn2", "btn3", "btn4", "btn5"];
for (i=0; i<myArray.length; i++) {
_root[myArray[i]].onRelease = function() {

[code]....

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Display A Random Number On The Click Of A Button Without Repeating Any Number In The Array

Sep 9, 2011

I'm trying to create a shuffle button for my mp3 player. I don't want it to repeat any song in the xml playlist until all the songs are played. Is there to display a random number on the click of a button, without repeating any number in the array until all the numbers in the array are used?

View 9 Replies

Actionscript 3 :: Button Reference In An Array?

Apr 11, 2012

I have two buttons that are in a movieclip, how can I reference them like I have done with the 2 buttons below so that they can be added into an array?

container.anotherButton and container.anotherButton2 are the buttons I want to add to the array.

var agreeButton:SimpleButton; var disagreeButton:SimpleButton;

var buttonArray:Array = new Array(agreeButton, disagreeButton);
for (var i:int = 0; i < buttonArray.length; i++) {
buttonArray[i].addEventListener(MouseEvent.CLICK, mouseClick);
}

View 1 Replies

ActionScript 2.0 :: Reference A Button In A Dynamic Array?

Mar 10, 2009

I've got a couple of columns of buttons loaded with attachMovie and looping through an xml array with a for loop, so they're named, for example, "thisBtn"+i+"_mc". But I don't seem to be able to reference them in the script with either a written-out name like thisBtn0_mc, or with "thisBtn"+i+"_mc".

How exactly do you reference each individual button?

View 7 Replies

Actionscript 3 :: Array Match Number Anywhere In Array / Return That Number / Values On Same Row

Dec 7, 2011

[code]I want to input a number and find a match for the number, returning the values on the row in to specific fields for each number. For example, if I input the number 10 in an input field, I want the number 1.2276, 0.00100, 106.38 and the rest of that row to output these values I have seen so many options, don't know where to start.

View 2 Replies

ActionScript 3.0 :: Error #1009: Cannot Access A Property Or Method Of A Null Object Reference At "frame Number:raw Number"

Oct 11, 2009

I created the following AS for a particular frame

Code:
cnx.addEventListener(CNXConnection.DIGITAL, onDigital_10);
function onDigital_10(e:DigitalEvent)
{

[code]....

While debugging everything works properly if I'm testing that frame.But, pushing a button in another frame, I get the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference at "frame number:raw number"

I'm quite sure that the problem is that the variable e.Join changes its corresponding e.Value pushing a particular button in another frame (as must be). Any ideas how to link that information to the frame that create the error?

View 1 Replies

Actionscript 3 :: Remove The Word Button From The Reference To Reference The Actual Item

Apr 11, 2012

I need to remove the word Button from the reference to reference the actual item that will be tinted.

[Code]...

View 1 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

Actionscript 3 :: Not Passing Number By Value, Rather By Reference?

Sep 27, 2011

I have this:

for (var i:int = 0; i < 3; i++) {
var newChoice:MainButton = new MainButton(function(){
trace(this["func" + i])} );
}

[Code]...

However, I get func3, which I assume is do to it finding the value of i. But shouldn't it pass by value since it's a number? How do I get the wanted result?

View 1 Replies

ActionScript 2.0 :: Way To Reference Functions By Number?

Jan 21, 2008

i'm working on, i've been tweaking my code and i've realized that i could simplify my code in a couple of areas if i could just assign functions numbers and have them called based off of a variable.here's an example of code which could be simplified: for my enemy AI, i have four functions and i want one of them to run, depending on the value of a variable [code]instead of doing all those checks, it'd be a lot simpler if i could number my functions (run_left would be 1, attack would be 3, etc) and replace the above code with something simple like " run function(ai_int) ".

View 3 Replies

ActionScript 2.0 :: SortOn(DECENDING) For The Number Array And Then Have The String Array Sort To Match

Jun 14, 2007

I have two arrays. One contains numbers and the other contains strings. I want to do a sortOn(DECENDING) for the number array and then have the string array sort to match. if my string array is

[Code]....

View 6 Replies

ActionScript 2.0 :: Random Number - Click On A Button The Variable Number?

Sep 18, 2005

lets say that when you click on a button the variable number goes up 1 or 2 but it picks it randomly
how would i do it

[Code]...

View 8 Replies

ActionScript 3.0 :: Target Of Assignment Must Be A Reference Number?

Jan 22, 2011

Im working on a multiplikation test in flash as a school project. I just wondering what the problem of this action script can be?The point with this script is that if svar1_txt equal to the number 10 that the user type in, it should give one point and number one is gonna show up in po�ng_txt.

var po�ng:Number = 10;
if (parsetInt(svar1_txt) = 10){
po�ng++;
po�ng_txt=String(po�ng);
}

View 2 Replies

Actionscript 3.0 :: Random Number MovieClip Reference?

Sep 21, 2010

I'm working on a project where I have 10 movieclips on the stage, each with a different instance name. I'd like to use a random number generator to play each one at random, but I'm not sure how to do it. I've been looking for the topic online but all I can find is loading them randomly to the stage... my movie clips are already on the stage. I want them to stay on the stage but only play when called upon* EDIT:ere's what I have. Super simple but I'm a little lost I guess.At the moment I'm referencing a function when I should be referencing a variable but I'm still not sure how to fix it.

function randomMC(low:Number=1, high:Number=10):Number
{
return Math.floor(Math.random() * (1+high-low)) + low;

[code].....

View 10 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 3.0 :: Access Of Possibly Undefined Property Number Through A Reference With Static Type?

Dec 24, 2011

I run into this problem today ... take a look on the code :

import com.trick7.effects.TeraFire;
for (var j:uint=0; j<10; j++) {
var fire:TeraFire = new TeraFire();

[code].....

View 6 Replies

Flash :: Methods To Objects Inside A Movieclip With Reference To Frame Label/number?

Mar 14, 2011

there is a movieclip named movie with instance name movie.Inside this movie there is a textbox in frame 1.I want to give properties and methods to that textbox.

View 1 Replies

ActionScript 2.0 :: Reference Everything Else In An Array?

Feb 27, 2007

I'm working on a set of buttons so that when one is rolled over, it gets larger and the remaining buttons get smaller. This however will all be housed in the rollOver function of the individual button rolled over. So I used an array and a "for loop" to encompass all of the buttons. I am able to reference the one I roll over by simply using "myButtons[i]" but I cannot figure out how to reference all the others using the array.

#include "mc_tween2.as"
var myButtons = [this.myButton_1, this.myButton_2, this.myButton_3, this.myButton_4];
for (var i=0; i<myButtons.length; i++) {

[code].....

View 7 Replies

ActionScript 3.0 :: Using Array Value To Reference 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)

[Code]...

View 3 Replies

ActionScript 1/2 :: Use Switch In Reference To An Array?

Mar 18, 2010

I have an array which changes with a pop and a push on button clicks:
 
var nextLoad = ["img0"]; It will always contain img0, or img1, or img2, etc
 
Then I'm trying to control another element on the stage by checking which img# is in the array:
 
trace (nextLoad); // this correct shows the new value in the array

[Code]...

View 5 Replies

Flash :: Can't Reference Nested Array

Oct 6, 2010

[code]...

This is nested inside another for loop which creates an array of the movieClip rows. Problem I see them drawn and positioned correctly on the stage but I cant reference any other than the top row in order to change the alpha for example.

View 1 Replies

Actionscript 3 :: Cant Reference Array Class?

Feb 3, 2011

I have a class consisting of a nested array called twoDArray.

public class TestArray
{
public function TestArray() {
var twoDArray:Array = new Array(new Array("one","two"), new Array("three", "four"));
}

[Code]...

I thought I would be able to reference OrbArray for example using trace(OrbArray[0][0]); giving me the output I am looking for of "one". When I attempt this I get ReferenceError: Error #1069: Property 0 not found on com.orbclasses.TestArray and there is no default value.

View 2 Replies

As3 :: Flash - Reference To Array By String (name Of Var)?

Feb 15, 2011

is it possible to create a new reference to an array by using it's varname ?

e.g.

private var _myArray:Array = new Array("a","m","d");
...
function getReference(_varName:String):void
{

[Code]....

View 2 Replies

Flash :: Reference An Movieclip With Same Name In An Array?

Mar 6, 2011

I realize this is very basic but i need a quick way of referencing all my objects in an array,I have a series of movieclips with instance names "block1" "block2"... etc.

I there a quick way to reference these in an array something like "block"+1 ?

View 1 Replies

ActionScript 2.0 :: Array Overwriting - Reference/value?

Nov 14, 2008

I've created two custom classes to contain data for a web forum controller flash tool:

class postClass
{
public var post_id:Number;
//plus some other variables like timestamp etc

[code]....

When I try to assign a new post to a user (by adding the post data to the postArray variable) I overwrite posts that I had already placed under other users. More specifically, if I'm posting the first post for User Y, I overwrite the first post for User X with the exact same data.I thought this was a reference vs. value passing error, but I tried to eliminate this by not copying the "postClass" objects, but assigning the data directly into the user's postArray array:

var userArray:Array = new Array();
function addNewUser(masterPostIndex,UserNumber)
{

[code]....

This all seems to work fine until I try to write a new post for a second or third user. If I trace the contents of User X's posts, they immediately become identical to the content of User Y's posts, as soon as User Y's posts are added. Later, when User Z comes along, both User X and User Y's posts are overwritten. This code is kinda long, so I didn't want to post the whole thing - but I can post any parts you're interested in, of course.

This really 'feels' like a reference-passing error (arrays are all looking at the same location in memory), but I can't figure out what I'm doing wrong - I'm not making a postClass object and then pushing it onto the user's postArray (I tried that too, same result).

var newPost:postClass = new postClass();
//read and assign values to newPost
userArray[userIndex].push(newPost); //

this is clearly passing the referenceI can see how the latter example would pass the reference to newPost to the user object, then when I change newPost in the next iteration (when user Y posts something), User X's data will change too. I tried to avoid this with the first set of code.

View 3 Replies

ActionScript 2.0 :: Giving An Array Like Reference To A Movieclip?

Jun 14, 2009

If n=1,b1.gotoAndStop(2); is to happen.n=2,b2.gotoAndStop(2); is to happen.But i don't want to put conditions like this.I want to putting something like this:b[n].gotoAndStop(2); or something.Is it possible.Is there any other alternate logic.

View 2 Replies

ActionScript 3.0 :: Reference An Array From A Stage In Class?

Nov 4, 2009

Ive got two classes and my stage. I'm trying to use an array to keep control of my enemy class's number for collision purposes and I managed to get the enemies to populate the array.

View 3 Replies

ActionScript 3.0 :: Reference Instance Of MovieClip From Array

Mar 23, 2012

I created an Array of lrgIcons that contains several MovieClips, they are then positioned within a second MC and pushed to a second array of lrgIconsOnStage, they are enabled as buttons and assigned an event listener (all of this works fine). Problem is, I want to know which lrgIcon is selected and react to it with an if statement. When I trace the array of lrgIconsOnStage I get [object amazonLrgIcon],[object emailLrgIcon],[object gmailLrgIcon],[object messagesLrgIcon],[object missedCallsLrgIcon] and when I trace e.target I get [object amazonLrgIcon] (depending on which item I selected, which in my mind, should trigger the code correctly, but it does nothing, Why?

Code:
var currButton:String;
var lrgIcons:Array = new Array(amazonLrgIcon,emailLrgIcon,gmailLrgIcon,messagesLrgIcon,missedCallsLrgIcon);
var lrgIconsOnStage:Array = new Array();
var lrgIconPosY:int = 69;
var lrgIcon:MovieClip;
[Code] .....

View 7 Replies

ActionScript 2.0 :: Reference Each Array Name To Pass Into Function?

Nov 12, 2004

In AS2 I have several arrays constructed like this :
var myArray0:Array=new Array(value,value,value...)
var myArray1:Array=new Array(value,value,value...)
var myArray2:Array=new Array(value,value,value...)
var myArray4:Array=new Array(value,value,value...)
...

What I'm trying to do is use iteration to reference each array name to pass it into a function.
Like :
function doSomethingWithArray(arrayToPass){
...
}
//Later somewhere in For loop... :
_root["myButton"+i].onRelease=function(){
doSomethingWithArray(WHAT-THE-HELL-I-TYPE-HERE[i])
}

View 2 Replies

ActionScript 2.0 :: Reference Array In A Class File

Oct 4, 2005

I have a class file that creates an array of image paths from an xml file. i need to know how to from the main stage refrance to get that array.

View 2 Replies







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