ActionScript 3.0 :: Dynamic Condition In A Loop?
Oct 11, 2010
I have a loop in a function which condition depends on some variables a,b,c and d. I would like to change that condition depending on where the function is called from. Would it be possible to assign those conditions to a variable (string maybe)?
Like this
function varcon():void{
while (conditionVar){
a=...
[Code]....
View 4 Replies
Similar Posts:
Jan 21, 2012
Is it possible to use a for loop within an if condtional statement? I have been trying but just get errors no matter what I do. I have a series of buttons that pop up in a window and I want to make it so a click anywhere outside of the buttons will close the pop up window. I have been doing this by running a hitTest that checks if any of the buttons are being touched one at a time. It works, but it seems overly tedious, especially since there are a lot of buttons. I do not want to put the hitTest on the background of the window because it will cause the mouse cursor to turn into a hand even when it is not over one of the actual buttons.
If the for loop can't be within an if condition, then maybe there is a better way to use the hitTest code, but I couldn't figure that out either. Here's a simplified version of what I have now (it works, but is too much code..):
[Code]....
View 6 Replies
Jul 15, 2009
Just wondering...s it possible to create a while() loop with as condition comparing a value against all items in array?e.g.
ActionScript Code:
while(myValue == for each(var i in myArray)) {
//Do Something
[code]........
View 3 Replies
Mar 9, 2011
i tried to use setInterval() and Timer function, but it doesn't work
Code:
for(i:Number=0; i<100; i++){
if(i%2 ==0 ){
trace("--------");
[code]....
View 5 Replies
Nov 9, 2011
I'm wrestling with an issue right now and I'm hoping for some help, and more so, I'm hoping I can explain my problem. With the thought of a "fill in the blank/drag and drop/string replacement" interaction, here's how my swf works:
I have a various movie clips that can be dropped on various movie clips.When one movie clip is dropped on another, the corresponding __#__ within myTitle.text will be replaced with a string that is related to the movie clip that was just dropped: i.e. myTitle.text becomes 'This is the most annoying [thing]...'Per that example I just mentioned, in the code below, my for loop searches for __1__ and moves the hTarg movie clips accordingly.Once a __1__ is replaced with the associated string I mentioned, the indexOf the __1__ becomes null because it no longer exists in the string, and the following startRect(s) below also become null.
So, my question is: How do I continue to loop through my for loop if the first index is null? I hope this makes sense, and I'm hoping someone can ituit what I'm trying to do based of my lousy explanation. If more clarification is needed, let me know and I will do my best to further explain.
[Code]...
View 5 Replies
Feb 12, 2011
I need to loop a flv file in flash if a condition is true.
So I tryed to add a listener but id doesn't work.. Code below:
textBox.addEventListener(FocusEvent.FOCUS_IN, focusInListener);
var connection:NetConnection = new NetConnection();
var stream:NetStream;
var video:
Video = new Video(200, 200);
var metaObj:Object = new Object();
[Code]...
View 2 Replies
Oct 28, 2010
How to initialize and make condition for 2 variables in single for loop in Flex let keep i and j are two variables
View 2 Replies
Sep 12, 2009
I have a BD return by PHP without problem : I have "all_good" and "no_good" If the variable change my condition don't change ..... why
[Code]....
View 3 Replies
Jan 1, 2011
How am i to get the variables zombData.zomb0, & zombData.zomb1 from inside the "for loop"
I want this trace command dynamic
Quote: trace(zombData.zomb+i);
it works when i put zombData.zomb0 (a variable sent from a PHP script)but if i want to make it dynamic how it is; It fails & outputs NaN How do i make it dynamic for the loop?[code]...
View 1 Replies
Jun 15, 2009
I have a small problem with dynamic targeting inside a loop. Shortly, I have some buttons which I add listeners to in a loop. loop works fine. I got everything to work, but the second line in it gives this error : TypeError: Error #1034: Type Coercion failed: cannot convert []@d4abe81 to Function.[code]Can anyone help me with the correct syntax for the second line ?
View 1 Replies
Jul 17, 2009
I have a variable called from a .txt file (don't ask - how the client wanted it) the variable reads... &ClientNumberOf=4 I have a for loop that uses that variable to set the limit on the number of times it loops...
[Code]...
View 3 Replies
Jan 13, 2009
I have created a movieclip. This movieclip will have 5 child Sprite's, which will contain an image pulled from xml. I want to create a for loop to create those 5 Sprite's, add the appropriate image into each one (i.e., img[0] into sprite[0]) and then add each sprite to the movieclip.
[Code]...
View 4 Replies
Jul 7, 2010
I'm attempting to use a for loop to set the onPress functions of all the buttons on a keyboard. Here is what i'm using so far:
Code:
Target.text = ""
Letters = Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "_")
[Code].....
View 2 Replies
Sep 5, 2010
I'm having a bit of trouble with a script to check a 'dynamic number'...
Basically, I've got a movie which plays in a loop and each time it goes around, it clicks up a number, which I have on the stage as 'dynamic text' called "ImageNumber" - this bit is working fine it uses the following code to add[code]...
View 8 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
Jul 16, 2009
I'm loading a variable from a .txt file into flash (per client request).The variable is as follows &ClientNumberOf=4 so the variable = 4, this works on trace, happy, joy When I try and add the variable to my for loop..[code]I've tried a slew of different options...(for example)var newVariable: Number = ClientNumberOf; Nothing works, again, trace works, but script fails to work when I try and dynamically set the loop?!
View 1 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
Jul 18, 2011
Why cant i do this in actionscript 3
[Code]...
Is there another way to achieve the same results?
View 1 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[code]...
View 1 Replies
Aug 12, 2010
I want to populate the stage with a list of dynamic text fields with individual names, something like pg4_txt1, pg4_txt2, pg4_txt3. I'm a novice at flash, I tried creating variables with a while loop, but I just haven't got the grasp of it.
Here's some kind of weird pseudo code to explain what I want to do:
var leading:Number = 15;
var i:Number = 0;
while (i<14) {
[Code].....
View 1 Replies
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
Sep 7, 2011
How can I load sounds using a loop? As there are around 20 sound files named something like s1.mp3, s2.mp3......sn.mp3
We can load sounds and create dynamic sound object in AS2 something like this:
ActionScript Code:
for(n=1;n<=20;n++){
_root["s"+n]=new Sound();
_root["s"+n].loadSound("s"+n+".mp3");
}
Is there anyway in AS3 to create dynamic sound objects?
View 1 Replies
Dec 18, 2006
I want to make a Blog in my website, but I don't know how to loop the parameters into the same dynamic text box! The XML will be basicly like this:
<xml bla bla bla's>
<post>
<newpost id=1>
<date>12.13.2007</date>
[Code]....
View 7 Replies
Jan 30, 2007
Well, i have this line of code
Code:
var t1:thumbBack = addChild(new thumbBack(x, y));
And i want to create many thumbBacks with names t1, t2, t3... with a for loop.
I tried something like this, but it doesnt seem to work
Code:
for(i=0; i<8; i++){
var this["t"+i]:thumbBack = addChild(new thumbBack(10 + i*200 , y));
}
View 1 Replies
Apr 26, 2007
I'm not sure why the dynamic text only appears once and doesn't loop. It's in a movieclip that's in another tweened movieclip. [code]...
View 4 Replies
Dec 5, 2008
I'm creating a searchable database in Flash where all the content loads dynamically from external sources. the main interface is columns of buttons where clicking in the first column sends the user to a named frame with a second column of buttons, then onto the third column then the final content is loaded into a new movie clip. The interface uses just one button(a movie clip) and the columns of buttons are created with a duplicateMovieClip function. that part works fine. However I can't get the button labels to load from an external text file even though I'm using the explicit button names, and I can't get the buttons to react to clicks even though they're "hot", i.e., the cursor changes when I mouse over them. the button behaviors use the dynamic button names.
Here's my code:
//creates a load Variables object
loadText = new LoadVars();
loadText.load("text/patent01NumbersText.txt");
//this makes a column of duplicate button movie clips
for (i=0;i<13;i++){
[Code] .....
View 3 Replies
Jun 24, 2009
am trying to load xml and make button for its length, and try to make function for each button i have i make buttons and i give them a unique name , but i can't make function for every one?here is the code
/////////////////////////////
var xmlLoader:URLLoader = new URLLoader();var my_Arr:Array= new Array();var arr_posX:Array =new Array();//= ["350","350","350","350"]var arr_posY:Array=new Array();//= ["80","120","160","200"]xmlLoader.addEventListener(Event.COMPLETE, showXML);xmlLoader.load(new URLRequest("Models.xml"));function showXML(e:Event):void { XML.ignoreWhitespace = true; var songs:XML = new XML(e.target.data);
[code]....
View 3 Replies
Aug 1, 2011
I am running 3 swf files for loop. Problem is after compiling the flash file swf file is getting slower and slower after two or three loops and stopping with one content finally. I don't know why it is happening my guess is "due to memory increasing causing flash file to slower".
package com {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLLoader;
import flash.net.URLRequest;
[Code] .....
View 5 Replies
Oct 4, 2011
im trying to load xml and make button for its length, and try to make function for each button i have i make buttons and i give them a unique name , but i can't make function for every one ?
/////////////////////////////
var xmlLoader:URLLoader = new URLLoader();var my_Arr:Array= new Array();var arr_posX:Array =new Array();//= ["350","350","350","350"]var arr_posY:Array=new Array();//= ["80","120","160","200"]xmlLoader.addEventListener(Event.COMPLETE, showXML);xmlLoader.load(new URLRequest("Models.xml"));function showXML(e:Event):void { XML.ignoreWhitespace = true; var songs:XML = new XML(e.target.data);
[code]....
View 2 Replies
Jun 25, 2010
I am loading an XML file into several textboxes. Each group of textboxes is contained in a movieclip. There is a textbox in each group that varies in height and I want to put each movieclip underneath each other. So I need to get the height of the previous mc in my for loop so I can set the y position of the next mc. I am not quite sure how this is done, but here is my as3:
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
[code]......
View 4 Replies