ActionScript 2.0 :: Assigning OnPress Functions In A Loop?

Sep 16, 2006

is that possible? i'm a complete beginner when it comes to flash and actionscript... so if it sounds like i dont know what i'm talking about... it's because i don't!let me describe my situation...I have about 20 boxes... and on each box i want to assign the onPress to trace the value corresponding to an Array at element "i" in the console...instead of doing:

Code:
box1.onPress = function() {
trace("the value is: "+hypotheticalArray[1]);

[code].....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Assigning Functions Via A Loop

Jun 21, 2004

I am working on a page where three differnt buttons effect one movie clips properties, the one movie clip will go to its rollover state when any of the buttons are on rollover, hmm, that sounds about right] i have assigned functions within a loop and the rollovers, rollouts and instance in the loop have been defined for all but the movieClips dont go to the right place. the code i have used is this....

[Code].....

View 3 Replies

ActionScript 2.0 :: Assigning Functions Via A Loop?

Jun 21, 2004

I am working on a page where three differnt buttons effect one movie clips properties, the one movie clip will go to its rollover state when any of the buttons are on rollover,i have assigned functions within a loop and the rollovers, rollouts and instance in the loop have been defined for all but the movieClips dont go to the right place....the code i have used is this....

Code:
for (var i:Number = 1; i < 4; i++) {
// attaching ALL rollovers to effect the interactive button
this["invis"+i+"_btn"].onRollOver = this["chart"+i+"_btn"].onRollOver = this["inter"+i+"_mc"].onRollOver = function() {

[code].....

all the traces show up correct but not the gotoAndStop on the movieClip (inter+i+_mc_)'s.

View 3 Replies

ActionScript 2.0 :: Assigning OnPress / OnRelease To MovieClip From Library

Mar 18, 2006

Lets say I have attached a movieclip from the library according to an array.length and I want to assign an onPress or onRelease on these movieclips attached lets say the length of the array was 4 .. so if I want to assign onRelease to this movieclips how do I do that?

View 8 Replies

Professional :: Stopping Previous Functions And Tweens OnPress

Apr 19, 2010

Trying to see if someone can guide me to a way I could stop my earlier tweens and onRollOver function when my onPress function is launched.  What I worked out here with that McX/YScale.stop(); and that target9_mc.onRollOver = null; is kind of working but I don't want the onRollOver function to stop until the onPress function begins.
 
[Code]...

View 1 Replies

ActionScript 3.0 :: Assigning Functions To The Keyboard

Aug 9, 2011

I'm trying to get the arrow keys on the keyboard to control timeline navigation. The AS3 code i'm using works the first time, but then goes a bit crazy and stops working for some reason. Please see my attached fla. In the example you're supposed to be able to navigate along the timeline using the arrow keys (going back and forth) I'm sure there's a really easy solution to this problem but I'm new to AS3 and can't figure it out.

View 1 Replies

ActionScript 2.0 :: Nested MC's And Assigning Functions?

Aug 16, 2005

I have a few rows of movie clips making a menu. Because I will be adding to the number of MC's I use a variable called "menuitems" and run a FOR loops to assign all of these MC's onrollOver, onrollOut and onRelease functions. I'm doing this to save having to assign these functions to them individualy (as they are the same functions). Its works fine, but when the MC is released it is told to jump to frame 2, where there will be nested mc's that need to be able to clicked and rolled over. Because the parent movie has event functions assigned to it they seem to overide them. Is there a way around this? I tried placing a transparent MC on the 1st frame of the movie and trying to assign the onRelease function to the "hotspot" but it doesnt work. Here is my code:

Code:
function buildthumbs () {
for (i=1; i<= menuitems; i++) {[code]...........

View 6 Replies

ActionScript 2.0 :: Assigning Functions To An Array?

Jul 20, 2004

I have a array of MC that are placed on the stage to make up a logo what i would like is to fade through the clips. I thought i could creat an array and atach a fade function to it but it dosn't seem to work.

here is my code

[Code]...

View 12 Replies

Adding OnPress To Mc, It Kill's The AS On The RollOver And RollOut Functions Of The Button Within?

Jul 13, 2003

I have an mc with a button nested inside and on this button I have AS for the rollOver and rollOut to play certain frames of the mc. The problem is when I use this mc (called 'mybutton_mc') in a menu system and I want to add AS to it to navigate to different areas, ie adding onPress to this mc, it kill's the AS on the rollOver and rollOut functions of the button within.

View 1 Replies

Actionscript 2.0 :: Assigning Functions To Multiple Buttons?

Aug 24, 2009

I have been trying to figure out this by myself for a while and needless to say, I have been completely unsuccessful. I have various a loop that creates multiple movie clips called: movie1, movie2, movie3, movie4... (you get the idea...) i want to assign roll over,roll out, press functions to all of theme.g. when you press on one movie, it highlights it.but I am trying to find a summarized way over writing each one out:

movie1.onRollOver=function(){
something happens
}

someonne once told me to use chartAt to do this, to reference different mcs, but I cant figure out how to do it.

View 1 Replies

ActionScript 2.0 :: Assigning Functions To Multiple Links?

Sep 29, 2006

For the past half-year I've been coding like this:

ActionScript Code:
_root.menu_mc.link1.onRollOver = function () {
_root.menu_mc.link1.text.htmlText = "<FONT COLOR='#000000'>" + "Cool" + "</FONT>";
_root.menu_mc.link1.text.thickness = 100;

[Code].....

I know and I've seen some more efficent code such as, making loops and assigning variables.

get started by making the above code more efficient? I've attached the source file.

View 5 Replies

ActionScript 2.0 :: Assigning Functions To Buttons = Not Working

May 20, 2008

here's the essence of what i'm doing:

[Code]....

View 9 Replies

ActionScript 2.0 :: [MX2k4]Assigning Event Functions?

Oct 14, 2003

why does this work:

[AS]for(i=0;i<perPage;i++){
with(_root.attachMovie("entry","entry"+i,i)){
_root["entry"+i].onRollOver = function(){

[code].....

View 1 Replies

ActionScript 2.0 :: Get To _root Functions After Assigning Lockroot?

May 18, 2005

is there any way to get to _root functions after assigning Lockroot?

i tried _level10.loadImages();

(loadImages is my own function)

View 1 Replies

ActionScript 2.0 :: Dynamically Assigning Functions To Button Events Results?

Jun 25, 2009

I am in the process of writing a scrolling image viewer that dynamically updates from an xml file. I have written the scroll function (with a lot of help from Kirupa and other sources), and the pictures are updating beautifully, but when it comes to adding the function for the buttons I am encountering an unusual error.

Using the following code:

Code:
initButtons=function(){
for (var i in btnArray) {
var btn:MovieClip = btnArray[i];

[code]....

from this site results in the doClick function being called for each of the buttons in the btn array at runtime, and then not working afterwards.

View 4 Replies

ActionScript 2.0 :: OnPress In A For Loop And Spacing?

Apr 9, 2008

Ok so options is the array there can be many or one outside swf. we go through the array creating empty movieClip and populating each with an outside swf. Once loaded i want to use these newly created movieClips as buttons.

1. can i declare the onPress in a for loop?

2. how do i centre and space them no matter how many they are the will be linear.

Code:
for (var i:Number = 1 ; i<options.length; i++){
//create a holder
_root.createEmptyMovieClip("optionD"+i,4+i);

[Code]....

View 1 Replies

ActionScript 2.0 :: OnPress - Four Buttons Inside For Loop

Jun 22, 2010

I'm trying to write onPress for 4 buttons inside a for loop.
This lines traces undefined:
Code:
trace(_root.TeachMethodArr1[count]) // undefined.
This is because count is no more starting from 0 when I click the buttons.

Code:
var TeachMethodArr1:Array=new Array()
var TeachMethodArr2:Array=new Array()
TeachMethodArr1 = ["a","b","c","b","e"]
TeachMethodArr2 = ["a","b","c","b","e"]
for(var count:Number=0;
[Code] .....

View 1 Replies

ActionScript 2.0 :: OnPress Loop For Multiple MovieClips

Apr 16, 2005

Everytime I press a movieClip, i -1(on the output window) should be equal to the number of the movieClip (ex: myClip17, when pressed, should produce in the output window a value of 17 for i-1). Please copy paste this code to a flash document and you'll see what I mean (please don't forget that you have to have linkage in the library for a movieClip symbol that you have to create - it's a circle only with stroke that has w=15 h=15). Every time I click on a number it should appear a circle on it. If the circle is already there it should disappear. But that's not the case. Somehow every movieClip has the order to attach one of the instances of movieclip marca_mc to myClip31.

var mcAcoplado = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
var diasDoMes = 31+1;
var distEntreTexto = 10;
for (i=1; i<diasDoMes; i++) {
[Code] .....

View 5 Replies

ActionScript 2.0 :: 4 Buttons Move Down OnPress Using The For Loop?

Mar 14, 2007

I using a for loop for a redundant action that I want to happen across 5 buttons. OnRollOver the button rotates. OnPress the button moves to a new position. It looks like this:

Code:
for(i=0;i<5;i++){
_root.swatch_mc['swatch'+i].onRollOver = function () {
this.onEnterFrame = function () {[code]....

My problem is this; onPress I want the button to move up (Ive achieved this already). I also want the other buttons to move down onPress (this is my problem). Is there a way have the other 4 buttons move down onPress using the for loop? Or is there another method of doing this?

View 2 Replies

ActionScript 2.0 :: OnPress Within A Loop (array Of Movieclips)?

Mar 6, 2012

I'm having troubble with the .onPress function. I've made an array of movieclips, and i want to go through them in a loop, and make an onPress function for each of them. What im trying to do with the code below is to make the debugText tell me what movieclip i pressed:

var letterArray = new Array();
letterArray = [l1_mc, l2_mc, l3_mc, l4_mc, l5_mc, l6_mc, l7_mc, l8_mc, l9_mc,
l10_mc, l11_mc, l12_mc, l13_mc, l14_mc, l15_mc, l16_mc, l17_mc, l18_mc,

[code].....

View 3 Replies

ActionScript 2.0 :: OnPress Loop For Multiple MovieClips?

Apr 16, 2005

The problem is: everytime I press a movieClip, i -1(on the output window) should be equal to the number of the movieClip (ex: myClip17, when pressed, should produce in the output window a value of 17 for i-1).Please copy paste this code to a flash document and you'll see what I mean (please don't forget that you have to have linkage in the library for a movieClip symbol that you have to create - it's a circle only with stroke that has w=15 h=15).Every time I click on a number it shouldappear a circle on him. If the circle is already there it should disappear. But that's not the case. Somehow every movieClip has the order to attach one of the instances of movieclip marca_mc to myClip31.

var mcAcoplado = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];

[code]....

View 5 Replies

ActionScript 2.0 :: OnPress Function For Multiple MovieClips In Loop

Mar 7, 2012

I'm trying to make a point and click game for the fun of it. I'm having troubble with the .onPress function. I've made an array of movieclips, and I want to go through them in a loop, and make an onPress function for each of them. What I am trying to do with the code below is to make the debugText tell me what movieclip I pressed:

var letterArray = new Array();
letterArray = [l1_mc, l2_mc, l3_mc, l4_mc, l5_mc, l6_mc, l7_mc, l8_mc, l9_mc,
l10_mc, l11_mc, l12_mc, l13_mc, l14_mc, l15_mc, l16_mc, l17_mc, l18_mc,
l19_mc, l20_mc, l21_mc, l22_mc, l23_mc, l24_mc, l25_mc, l26_mc, l27_mc,
l28_mc, l29_mc, l30_mc, l31_mc, l32_mc, l33_mc, l34_mc, l35_mc, l36_mc];
[Code] .....

DebugText outputs:
Pressed movieclip nr: 36 36 36 36 36 36
No matter what clip i press, i get the same output: 36. why?

View 5 Replies

ActionScript 3.0 :: For Loop Not Assigning Value To Array?

Dec 13, 2009

is there anything changed in actionscript in flashbuilder 4? i'm new to as3.... why is following for loop not assigning value to array ?i tried in various ways, but could not get it

Code:
<fx:Script>
<![CDATA[

[code].....

View 2 Replies

ActionScript 2.0 :: Using For Loop To Create MCs And Assigning Value

Jun 14, 2007

I'm trying to use a for loop to create 219 movie clips and have it assign the value i to each one. This is how the movie clips are named on the stage
rollover1_mc, rollover2_mc, rollover3_mc and so on.

Heres the for loop I was trying:
Code:
for(i=0; i<220; i++){
rollover + i + _mc.onRollOver = displayContent;
}
doesn't seem to be working.

Basically I need it to repeat so i creates the following lines of code:
rollover1_mc.onRollOver = displayContent;
rollover2_mc.onRollOver = displayContent;
rollover3_mc.onRollOver = displayContent;
etc, etc.

View 2 Replies

ActionScript 3.0 :: Assigning Text In A For Loop

Sep 23, 2010

In the for loop below I use the "i" var to work with 5 movieclips. The problem is that I also want to use the same "i" var to assign text to a textfield but I can't figure out how to do it. (tf.text = String("txtInfocon"+i);)

Code:
var numbChildren:uint = this.numChildren + 1;
var txtInfocon5:String;
var txtInfocon4:String;

[Code]....

View 2 Replies

ActionScript 3.0 :: For Loop Assigning Projectionpoint?

Sep 29, 2011

don't fully understand the Projectionpoint trick to flip items with the projection point at their own center in stead of the stage center so I can't seem to figure out how to for loop enough points to each movieClip on stage so it will flip around its own axis in stead of the stage axis.I hope I made myself clear there...

PHP Code:
for(var i = 0; i < obj.numChildren; i++){ if(obj.getChildAt(i) is Flip1Button)

[code]....

View 2 Replies

Assigning Tween Function In An Array Through A Loop?

Mar 17, 2010

I have been trying to assign tween function in an array through a loop in as3.I have 20 mc on stage, the instance names are obj1, obj2 and so on.I want to assign a tween function to each of them, the function looks like this :

Actionscript Code:
function startTween(e:TweenEvent = null):void {xTween = new Tween(obj1, "x", None.easeNone, obj1.x, Math.random()*20, 0.2, true); 

[code].....

View 3 Replies

ActionScript 3.0 :: Loading XML And Assigning Listeners In A Loop?

Jul 26, 2010

I am loading a XML of county data for western US states and assigning listeners to movie clips of those counties.  The counties have names that are equal to the field named afips in the xml.  I am trying to assign listeners to those movie clips as called through a for loop.  The counties are children of the parent MC name all_cnt.
 
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

[Code].....

View 7 Replies

Actionscript 3 :: Assigning Dynamic Masks For Loop?

May 18, 2011

I'm loading 8 thumbnails via XML, placing in a sprite, and spacing them out with a helper grid class. This part works. What does not work is when I try to assign a mask to each of these (using a simpleRectangle class I made) I appear to only be assigning a mask to the last image. Am I doing something wrong with 'imageLoader.mask = _mask;' ?

My ultimate endeavor here is to click the thumbnail and animate the mask to reveal the entire thumb.I nested the showPictures function so it could have a reference to the masks, which is not optimal.

package
public class MiniGallery extends Sprite
{
//create($columns:int, $rows:int, $xSpacing:int, $ySpacing:int, $xPadding:int, $yPadding:int)

[code]...

View 1 Replies

ActionScript 2.0 :: Assigning Actions To Buttons In A Loop?

Sep 17, 2004

I have is a movie with a button in it called button.i've duplicated the movie (manually) several times on the stage.the movies have been given instance names of movie1, movie2 etc.i've then used actionscript to assign actions to the buttons.i have the following code:

Code:
for (i = 1; i < 6; i++)
{

[code].....

View 2 Replies







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