ActionScript 1/2 :: Variable Inside 'for' Loop With Parenthesis
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
Similar Posts:
Jan 19, 2012
I'm trying to toggle 2 global Boolean variables inside of an ENTER FRAME loop. "Eating" and "WasEating". When these 2 objects hit each other "Eating" is set to true, and an animation plays to show that my character is eating. When the 2 objects DONT hit, I want to change my "WasEating" variable to true ONLY for that one frame (then setting it back to false), and to change back to the original animation when the Hero was NOT eating.
The issue I'm having is my variable is getting toggled true to false, false to true, every frame, not what I want. I want to have this happen ONLY ONCE, based on the hitTestObject function in the loop. For example:
ActionScript Code:
addEventListener(Event.ENTER_FRAME, loop);
function loop (e:Event):void {
[Code]...
View 2 Replies
Jun 17, 2011
I've been programming some stuff in Actionscript (haXe) and arrived this very specific problem. Here's the code (pseudo :S):
[Code]...
View 2 Replies
Nov 29, 2010
i'm trying to use the trace() function to get an output that uses a parentheses <"> within it.My problem is that when i type my trace, for example:
trace("Andy will say" + " " " + Hello.text + " " "); is suppose to come out saying: Andy will say "Hello".
But the AS3 reads it such that the parentheses after "Andy will say" and after Hello.txt are normally utilized parentheses.
View 3 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
Nov 9, 2010
Should I declare the _mcContainer var before the loop or no? (performance increase?)
for(var i:uint = _startIndex; i <= _endIndex; ++i){
var _mcContainer:MovieClip = _mcParent["i_" + _position];
}
[Code]....
View 1 Replies
Mar 2, 2007
I have some code that seems to have a problem. I can't seem to pass the x variable from one loop to within another loop.
Code:
var myLv = new LoadVars();
var myNv = new LoadVars();[code]....
View 2 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
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
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
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
Apr 23, 2011
I'm creating a website using Adobe Flash Professional CS5. I'm trying to read the content of a text file with URLLoader.load(path) inside a for loop. The path changes every iteration. When I trace the data from the event handler method, it returns only the last path's text file's content. It seems like it's calling the event handler method only after the for has done looping.
CODE:
var myData:URLLoader = new URLLoader();
myData.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void
{
[Code]....
View 2 Replies
Jan 21, 2009
I'm using a few for() loops to populate my game. Now, I have 2 versions of each function, one that executes when my variable "debug" exists, and the other that activates only if "debug" does not exist.Looks kinda like this:
ActionScript Code:
// first, if debug exists, the script will execute for the single instance of my movie clip "myBox_0".
if(debug){
// assign a value to the string "myTarget"
[code]....
Now, on the line I starred*, if I enter "images/0" instead of what you read there, then it works. But when I try to use the variable "i" then it gives me the error "Error opening URL 'images/undefined.png'" I ran a trace statement to track "i" through the code and it works up until I enter the tellTarget statement... how can I get my script to pass that variable through that statement?
View 2 Replies
Jul 13, 2009
I'm trying to create an XMLList for each element on my XML var. [code]...
View 5 Replies
Jul 19, 2009
i want to query about a point here,
Now, When i make a loop for example a "for" loop
ActionScript Code:
var i:int;
for (i=0;i<4;i++){
// Looping Code For 4 Times
}
in the looping code, when i use a variable, for example "myVar"
Can i make the variable name be "myVar0" in the first time looping, and the name be "myVar1" in the second time looping, and so on ..
View 6 Replies
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
Mar 19, 2011
I'm trying to create pause functionality in my flash app.How would I go about doing this:
Code:
function pause(pauseTime)
{
[code].....
View 4 Replies
Dec 14, 2011
I'm trying to display the current loading/buffering percentage by displaying it in a label.
Somehow, when the for-loop starts, the text wont update. It seems that the app is too busy rendering my frames so that it wont update the text..
This is parts of my code:
ActionScript Code:
for (var i:int = 0; i<=359; i++){
myMovieClip.gotoAndStop(i);
mySWFBuffer = new BitmapData(myMovieClip.width, myMovieClip.height, false,
[Code].....
View 2 Replies