ActionScript 3.0 :: Dot Syntax Inside For Loop
Aug 11, 2011
I have put all button inside movieClip called "container" and I have added "container." inside for loop and now I am getting errors.
for (i=8; i<15; i++){
container.this["button" + btns[i].name.replace("btn","")].mouseEnabled = false;
}
View 7 Replies
Similar Posts:
Dec 15, 2005
I've got a for loop and some fuctions working, but can't get one line of code to work. The red line below is what I'm having a hard time with. I'm calling a function called "moveit". If I insert moveit(x1, y1); then it works, and my movieclip is moved to the x and y positions that I specified for item #1. Though I want it to work for 10 items (I only have coordinates for two here, and will add the rest later).
I've searched my ActionScript book and just can't figure out what the syntax should be for calling that function.
[Code]...
View 14 Replies
Sep 15, 2009
I have an array like this:
Code:
var myData = new Array();
myData["name"] = "John";
myData["Age"] = 35;
What is the syntax to loop through and get the key and value? I have tried for each and for in but they just give me the value of "John" or "35", how can I get the key e.g. "Name" and "Age"?
View 2 Replies
Sep 7, 2006
I've got this loop and can't get it to work. It won't read the trace so I know the array call in my function statement is wrong but I can't see it at the moment. What am I doing wrong here? The rollover works when I write it out repetitively for the four buttons.
var btnAction:Array = new Array (oneBut, twoBut, threeBut, fourBut);
for (var i=0; i<btnAction.length; i++) {
this.menuMC.btnAction[i].onRollOver = this.menuMC.btnAction[i].onDragOver = function() {
[code].....
View 2 Replies
Sep 18, 2009
what I'm trying to do is access the data of several movies clips, that are inside of several other movie clips: MC1.insideMC._visible=false (which works, but isn't dynamic) but dynamically with a FOR loop. I've tried: For(bullet=1; bullet<5; bullet++){ "MC"+bullet.insideMC1._visible=false (this does not work) } Does anyone know the dot notation or another way to do this?
View 13 Replies
Aug 29, 2006
I've got this loop and can't get it to work. It won't read the trace so I know the array call in my function statement is wrong but I can't see it at the moment. What am I doing wrong here? The rollover works when I write it out repetitively for the four buttons.
var btnAction:Array = new Array (oneBut, twoBut, threeBut, fourBut);
for (var i=0; i<btnAction.length; i++) {
this.menuMC.btnAction[i].onRollOver = this.menuMC.btnAction[i].onDragOver = function() {
trace("anything");
}
};
View 1 Replies
Mar 25, 2007
Whats the correct syntax for declaring a variable within a loop? Something like this:[code]
View 1 Replies
Apr 30, 2008
class actionscript.Time extends MovieClip
{
private var dateTimer:Number;
[code]....
View 3 Replies
Jun 30, 2009
I have a series of images loaded in via XML and assigned to "loady" movieclips. This code works fine:
Code:
_root.myMCL.loadClip(_root.myImages[0].attributes.url,_root.loady0);
_root.myMCL.loadClip(_root.myImages[1].attributes.url,_root.loady1);
_root.myMCL.loadClip(_root.myImages[2].attributes.url,_root.loady2);
_root.myMCL.loadClip(_root.myImages[3].attributes.url,_root.loady3);
[code]...
I want to replace this with a loop since I know the total amount of items (myImagesNo), but this isn't working:
Code:
for (i=0; i<_root.myImagesNo; i++) {
_root.myMCL.loadClip(_root.myImages[i].attributes.url,this["_root.loady" + i]);
}
View 2 Replies
Mar 12, 2010
I have a series of images loaded in via XML and assigned to "loady" movieclips. This code works fine:[code]
View 1 Replies
Aug 13, 2010
One (dumb) question: Is it possible to use flex 4 syntax declaration inside of a actionscript method? For example, something like that:
[Code]....
View 2 Replies
Nov 9, 2010
Can anyone tell me why the following is taking 4 seconds for Flash to execute:
_moleHoles = new Array();
var countingMoleHoles:Boolean = true;
var holeCount:int = 0;
[Code].....
There are 9 object on the stage (but this number could go up or down, that is why I'm dynamically grabbing these this way). So in my test case, this loop runs 10 times.
I have narrowed it down to something to do with the following line:
if (this['moleHole' + holeCount])
Is using dynamic (array syntax) object lookup that much of a performance hit?
View 2 Replies
Dec 8, 2009
I have done this same thing in ActionScript 3, but am not familiar with ActionScript 2, which I am forced to use for this project. I am loading products into a SWF via XML and attempting to add a click event to each dynamically-created movieclip. Simply tracing the text from a node in XML will do for now. I'd like to assign a property called "desc" or "description" to each movieclip and have it trace that property's value when clicked. Here is the relevant portion of my code as it stands:
ActionScript Code:
var iXML:XML = new XML();
iXML.ignoreWhite = true;
[Code].....
View 6 Replies
Feb 2, 2005
I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.
var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();
[code]....
View 2 Replies
Jun 6, 2010
I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.
var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();
[Code]....
It dies every time on that last line. How do I refer to that vidThumbn instance so I can add the imageLoader? I don't know what I'm missing. It feels like it should work.
View 2 Replies
May 15, 2011
I'm trying to make a matching pairs game. First of all I'm making all the tiles, using a loop inside a loop. How do I get the ID of an item inside that loop? My code looks like follow:
Code:
var matches:Array=new Array(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8);
makeTiles();
function makeTiles() {
[Code].....
View 3 Replies
Jul 14, 2011
using action script...
stop();btn001_btn.addEventListener(MouseEvent.CLICK,showimage1);function showimage1(event:MouseEvent):void { gotoAndPlay(10);}btn002_btn.addEventListener(MouseEvent.CLICK,showimage2);function showimage2(event:MouseEvent):void { gotoAndPlay(20);}
however movie is playing without stopping to "Listen" for a Mouse CLICK. Images placed at frame 10 and 20 should appear only when CLICK'd.
This code is straight out of Classroom in a Book CS4.
View 5 Replies
Oct 19, 2009
Here is my problem:Instead of placing my photo holders randomly on stage,I would like to have them in a grid form.
Code so far:
Code:
totalPhotos = total;
[code]....
View 1 Replies
Apr 5, 2010
I am quite new to AS3 and I am having trouble adapting my knowledge of Java to this new language i am trying to make a simple grid in which i could work on each individual square seperately(changing their colour for example). To do so, I created a 2D array,hoping it would allow me to work with some kind of coordinates system. I initialised the array using while loops and for some reason, this does not let me access the array outside the loops.[code]The two last lines are causing the problem, instead of turning the last square red, they return the following error: TypeError: Error #1010: A term is undefined and has no properties.However, when placed inside the loop, there is no problem and the whole grid turns red.
View 3 Replies
Jan 22, 2011
I need to insert a flv into a new flash project and I want that video to play non-stop.
View 3 Replies
Aug 1, 2011
I am having a hard time trying to use an onRelease event handler inside a for loop. Basically, I am developping a custom player for articulate presenter using flash and AS2.This code is generating a movie clip in a for loop for each line in the sidebar, with slide title and slide number parsed from a XML.Until here, all works fine.But when I try to generate the onRelease event handler to play the wanted slide when I click on the line, the value inside the onRelease is always the highest value of i.Looks like the onRelease evaluates i only when I click on the line, after all the clips have been generated.[code]I have to find a way to capture the value of i for each clip.
View 2 Replies
Jan 29, 2008
how to call a function via setInterval a limited number of times (e.g. 20 times).
Code:
function CallMe(Me){
trace(Me);
}
for(var i:Number = 0; i<=20;i++){
setInterval(CallMe(i),3000);
}
My intention for the above simple code would be to have 'i' get traced every 3 seconds. But it doesn't. 'i' just gets dopped out into the output pane all in one go. Do steady release!
View 1 Replies
Jun 2, 2011
I am having an issue with a hitTestObject inside a for loop. When I drag an item it traces back that it was a hit but still animates back to its original place. I can't figure out what is going on with this... Here is my code
[Code]...
View 3 Replies
Jun 15, 2011
I have a movieclip called _container which I'm adding to the stage 6 times (it will be dynamic so the number can vary). [code]...
View 4 Replies
Jul 20, 2011
-: b1 = blade.. rotating and moving along y axis... its position in the stage is x = 120 and y = 20.. but when i test it tracing(_y) shows dat d first value comes 42.85 and not 20(value from the properties).. i dont know how to get its exact value just like what is seen from the properties.. i've tried to have an if statement that if the value of _y = to the y coordinate the blade position that will alter its movement, it never turns like i want.. here is my facebook email add( punisheryuri11@gmail.com ).. please help me if u have a spare time..
onClipEvent (enterFrame) {
_root.b1._y += 2;
_rotation += 30;
trace(_y);
[Code].....
View 3 Replies
Mar 26, 2010
I am trying to load a group of thumbnails using Moviecliploader within a class function. Only the last image is loaded onto the stage. can anyone point me in the right direction, I have been wrestling with this for a couple of days. I have tried it with a single loader... loaders created in the loop, stored in an array...
and loaders as a child of the dynamically created image+x clip (ie. _level0.Gallery.image1.image & _level0.Gallery.image1.mcLoader)
[Code]....
View 2 Replies
Feb 3, 2011
want to make this stuff working.
Actionscript Code:
for (var i:Number=1; i<=3;i++){ var char_name+i = event.target.data.char_name_ + i;//It should be like//var char_name1 = event.target.data.char_name_1;//var char_name2 =
[code]....
View 2 Replies
Sep 5, 2009
how Im going to put the i variable inside the [[[[ ]]]]] because I cant make it work for(var i:Number=0;i<products;i++){ _root.menu["product"+i]._x += (product[[[[[+i]]]]]x-_root.menu.product["product"+i]._x)/speed; }
View 5 Replies
May 29, 2010
possible to have a timer that works inside a 'for' loop? I have created a timer but it only activates each time the frame is run through. I have a for loop with i++ so that I can put objects on the page with a small pause between them. The i++ loop puts all the movieclips on the page simultaneously. I need a delay and a loop because the shuffled arrays will be reset each time the frame refreshes.
View 1 Replies
Feb 4, 2010
I am trying to find the index from an array using a loop function, but I am getting an error:
private function findMatch(matchValue:int):int {
for (var i:int = 0; i < playersList.length; i++) {
if (playersList[i].value + matchValue == levelTarget) {
[code].....
View 4 Replies