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


Similar Posts:


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 :: 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 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

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

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

ActionScript 2.0 :: Assigning Button Actions Within A Loop?

Jun 30, 2005

This function all works correctly, except where i am assigning an action to the onRelease event of a given button. Every button is assigned to the same value (appears to be the first value pulled from the array).

function createSubItems() {
vspacer = 6;
i = 0;

[Code]....

View 2 Replies

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

ActionScript 2.0 :: Assigning Actions To Buttons In A Loop

Sep 17, 2004

i'm pulling my hair out over this one. 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]...

View 2 Replies

ActionScript 3.0 :: Assigning Names To Movie Clips In Loop?

Mar 21, 2009

im trying to run a loop and assign all my new movie clipswith different names. i have tried .name and ._name they dont seemto be working..

for (var i = 1; i<=5; i++) {
imageName = new ImageMovie();
this.addChild(imageName);

[code].....

View 1 Replies

ActionScript 2.0 :: Assigning External Swf To A Button Via Array/loop?

Jul 11, 2007

I have great difficulties with something that should be rather simpel to solve, but the problem is that I'm out of solutions to my problem.The buttons that are created from an loop that retrieves it's data from array's doesn't load the external swf, instead it gives my an 'undefined' output.I tried several different array constructions found on other threads, defined them differently, but it won't work.

Here's what I'm working with:

[AS]buttons = [m1, m2, m3, m4, m5, m6, m7, m8];
titles = ["BOEDDHA", "GELUKSHOEKJE", "GEUREN", "INTERIEUR", "VECHTKUNST", "PERSOONLIJK", "SERVIES", "VERMAAK"];
swfArray = ["products.swf", "products1.swf", "products2.swf", "products3.swf", "products4.swf", "products5.swf", "products6.swf", "products7.swf"];

[code]...

As you see, I made an Array of the .swf's, put the swfArray in a loop and tried to define them to the buttons with the onRelease function.

View 2 Replies

ActionScript 2.0 :: Creating Variables In A Loop And Assigning Them Non Empty XML Values

Jun 1, 2011

Here is the structure of the XML file: PHP Code: <xmlfile><page></page><page> <source></source> </page></xmlfile> Some "page" nodes contain the extra "source" node. What I'm currently doing is looping through all the page nodes and looking for any source nodes. If there is a source node, I create a variable, and want to assign it a value of the contents of the "source" (HTML).

[Code]....

View 1 Replies

ActionScript 3.0 :: Create A Loop So Icons In Menu Continually Loop Indefinitely

Apr 16, 2010

I would like to create a loop so the icons in the menu continually loop indefinitly.[code]

View 2 Replies

ActionScript 3.0 :: Use A Loop To Create Text Field With The Loop's Current Value

Dec 11, 2010

I am attempting to use a loop to create text field with the loop's current value. The code looks like this:

ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}

So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".

View 7 Replies

ActionScript 2.0 :: How To Create A Loop

May 24, 2007

I am trying to create a loop, that will lop through the following XML:

<pages>
<page pageName="Front Cover" pageID="0">pages/page00.swf</page>
<page pageID="1">pages/page01.swf</page>
<page pageName="Page 2-3" pageID="2">pages/page02.swf</page>

[code].....

And when i then trace this loop statement I want to only have the pageName attribute trace out?

View 1 Replies

Using A 'for' Loop To Create Similar Varibales?

Jun 19, 2009

I'm trying to create a number of similar variables using a for loop, rather than having to explicitly write out each variable. For instance, I need 9 variables called zone1, zone2, zone3 etc. So rather than writing it out like so...ActionScript Code:public var zone0:Zone = new Zone(); public var zone1:Zone = new Zone();  public var zone2:Zone = new Zone();// etc. etc. After a look around on the internet, I came up with this, however, it doesn't work...ActionScript Code:for (var i:uint = 0; i<=8; i++)public var this["zone" + i]:Zone = new Zone

View 3 Replies

ActionScript 3.0 :: Create Tweens Within A Loop?

Aug 13, 2009

I'm pulling data from xml and using a for loop to have each line of text appear on screen. I want to have each of these ease in. I don't know the number or size in advance, so each textfield is created dynamically.What I've tried to do is dynamically create a tween for each dynamically created textfield, but I just can't seem to get the syntax right. This is a snippet from what I've got at the moment, inside of the function that's called once the xml is successfully loaded:

var bl:XMLList = fsXML.content.point;  var points:Array = new Array();  var Btween:Array = new Array(); for (var n:int; n<bl.length(); n++) {  var p:TextField = new TextField(); p.name = "points" +

[code]......

View 3 Replies

ActionScript 3.0 :: Create Movieclips Using A Loop?

Mar 8, 2011

Is there a way I can create these clips and add them to an array in a loop ? It doesn't seem to want to work for me.. ?
 
                var p1 = new P1;                var p2 = new P2;                var p3 = new P3;                var p4 = new P4;             var p5 = new P5;                var p6 = new P6;                var p7 = new P7;                var p8 = new P8;             var p9 = new P9;                var p10 = new P10;                var p11 = new P11;                var p12 = new P12;            var p13 = new P13;                var p14 = new P14;                var p15 = new P15;                var p16 = new P16;            var p17 = new P17;                var p18 = new P18;                var p19 = new P19;                var p20 = new P20;

View 2 Replies

Flash :: Create An Intro Followed By A Loop?

Apr 3, 2010

I just recorded some song and cut it into two parts. The first part contains an intro and the second is supposed to loop. What I want to do now, is to have a simple graphical animation (5 keyframes or so) that loops as well, while the music plays along.

View 1 Replies

ActionScript 2.0 :: Create A Loop For 20 Buttons?

Feb 19, 2009

I want to create a loop for 20 buttons:

[code]....

the code within the rollover/rollout function doesn't work. It does work when outside of the function or when the code doesnt use "g".Is this because once inside the rollover/out function it always brings back the last value of "g" ... in this case 20?[URL]

View 6 Replies

ActionScript 3.0 :: Create Multiple MC's In A Loop?

Oct 26, 2009

I want to make multiple empty MCs and fill each one with a thumbnail for a menu. I want to do this using for loops so I can control as many as I need.

What's the most efficient way of doing this?

I'm used to creating empty MCs in AS2, but I'm not familiar with the new display object way of handling this method.

So far I have this:

Code:
for (i=0; i<numImages; i++) {
thmb.push(gallery.features.image[i].@thmb.toString());
var imageLoader:Loader;

[Code]....

View 6 Replies

ActionScript 3.0 :: Create An Increment Within A Loop?

Oct 11, 2010

I am trying to create an increment within a loop, that gradually increases and then decreases. The total of all increments should equal the total change.

I am using the following equation:

PHP Code:

private var _totalInc:Number = 0;
private var _time:int = 0;
private var _duration:int = 60;

[Code].....

The problem is, when the trace output at frame 60 should be _totalInc == _change. why it's a few degrees short?

By the way, totalInc is purely used to debug and is not needed in the final program. I am interested in inc.

View 4 Replies

ActionScript 3.0 :: Create A Loop With A Delay?

Nov 10, 2011

Im new to action script and am just starting to understand it. Im trying to create a loop with a delay in it but am not having much luck passing growing variables to the new function.

[Code]...

View 2 Replies

Actionscript 3.0 :: Create A Map From An Array Using A For Loop?

May 18, 2009

i have created a map from an array using a for loop via this code:

for (var k in map1[0]) {
for (var i in map1[k]) {
if (map1[k][i] == ground) {[code]..........

my question is how do i set a delay timer thing so i can watch it put down each tile ie. there is a half second delay between each tile being put down

View 1 Replies

ActionScript 2.0 :: Create A Grid With A For Loop?

Feb 8, 2006

Let's say I have a movie clip of a square in my library and I want to use a for loop to create a 10x10 grid of those squares. How do I approach that?

Spacing each square horizontally or vertically isn't a problem for me but I'm hung up on how to add 10 squares and then start a new line.

View 7 Replies

ActionScript 2.0 :: Use A For Loop To Create Instances?

Aug 27, 2006

I'm trying to parse an XML file, and use it to create instances of a custom class the fly in actionscript 2. (can't migrate to 3 for this project).I'm trying to make something happen like:

Code:
for (var i:Number=0; var<n; var++) {
instanceName="MyObject"+i;[code].....

Which doesn't work.When it's all done, I need to have n objects named MyObject1, MyObject2, ..., MyObject(n).

View 2 Replies







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