ActionScript 2.0 :: Are There Loops In Flash
Jun 28, 2005are there loops in flash like Do while loops, or for next loops?
View 1 Repliesare there loops in flash like Do while loops, or for next loops?
View 1 RepliesThe trace on this loop shows the values are changing, but the actual event is instantaneous and without alpha.
PHP Code:function txtFade(mc:Object,i:Number):Number{[code]....
I am making a flash movie, using text moving across the screen in semi transparency, sort of as a background. In the center is a white box, and content within that box. The semi transparent text scrolls back and forth throughout the movie. But when the movie loops back to the beginning , the white box and content within it vanish for a second...then reappear as the movie begins again. I don't want that microsecond vanish to happen but I don't know how to prevent it.
View 3 RepliesSo basically I have this map. On this map I have points, and when you click on these points it goes to a URL.The code setup is as follows:
Arrays to define the movieclip locations and another for the urls (this one is an associative array). I then create a function loop to make an event listener for each point. When the point is clicked it will run another function that handles the URLs. The URL function is to grab the target point that has been click, use the url array type to find the key, and then throw it in to the URLRequest.
So far I have this code:
var places:Array = new Array();
places = [
map.paulsens, map.paraburdoo, map.plutonic, map.wiluna, map.gwalia, map.wallaby,
map.sunrise, map.moora, map.marvel, map.flyingFox, map.ernest, map.rosebery,
[code]....
So it's obvious to me that the openLink(); function isn't doing what I want it to. I can kind of guess because event.target isn't being turned in to a string or not pulling the array's type?
i'm using the loadSound command to bring in an external mp3 and although the file itself is a perfect loop, flash doesn't seem to like playing it back as such using the s.start (0, 5) tag. any suggestions on how to get perfect loops?
View 3 RepliesI have this xml document thats created via php that looks like this. (Note: sample of the xml not full.)
HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<cms_item>
<product_item>
<product_id>1</product_id>
<product_name>chairs</product_name>
[Code] .....
This is created from a database and the xml is the a combination of the two data tables. Now I have created a class file which can read this xml data or any xml doc in that format of childNodes and what not and return the results as an array. Is it better to work straight from the xml object or from the array. And is there a better way of doing this so its a lean mean array creating machine?
What are the advantages and disadvantages of having just one main loop and having a main class control individual objects on your stage, in oppose to having each individual object have its own loop and giving it the responsibilities of doing what ever it has to do on its own. What are consider best practices.
View 3 RepliesI want to create a tab-enabled popup window in an AS3 Air project. Currently, when I press tab several times, the focus goes through all the components in my popup window and then starts focusing the buttons and TextFields from the components that are behind the popup. I have tried to solve this problem in two ways, but none of them worked. I will explain both of the methods here
[Code]....
1. a button is clicked (calling the playSound function)2. the sound is then played, also a small instance of the button is called from the AS library and placed within a sprite that is within a movie clip at the bottom. The event listener is also removed from the main button so it can only be called once.3. when the small instance of the button is pressed (within the sprite) it stops the sound, removes the icon and re enables the buttons event listener.It all works fine, and it is worth mentioning i am still new to Flash but getting to understand it more (after a little bit of light hearted abuse from a few members ). What i am struggling to understand is how to 'streamline' my code. I plan on having 20 buttons on the screen, and surely theres an easier way then having 20 functions, all more or less doing the same thing!
View 3 RepliesI'm using this var timer2 = setTimeout(checkValue2, 2000);
as a frame action in Frame 2, which then triggers checkValue2 which is a piece of function in Frame 1 where all the _global. variables are as well.
clearTimeout(timer2);
gotoAndStop(3); //goto lvl3 - throw
addStage3();
it'd then goto Frame 3, but, the problem is even after clearing, the frame animation still loops every 2 seconds, regardless whether i'm using setTimeout or setInterval. Do you might know of any other way where what I need is, after 2 seconds in Frame 2, it'd then move to Frame 3, which I don't want it to go anywhere yet.
I'm a newbie to Flash. I have created a basic screensaver which has 8 different layers. 7 are hidden and 1 plays through as it is now. I was wondering if there is any way that on completing the timeline, it starts the timeline again and then shows the second layer and masks the 1st one. It would then do the same, masking the 2nd layer and showing the 3rd and so on.
View 1 RepliesI would like to create a flash movie that loops through 11 dynamic images continually with a fade-in, fade-out each image.
View 2 RepliesI want to create a flash application where users will have access to 10, 5 seconds audio loops. They can choose any 4 tracks to make a 20 second track. I then want that mp3 to be stored somewhere or flash to create to a file which can be sent to friends in facebook where they can listen to that beat. There will be a little button at the bottom saying 'click here' to make your own beat.
View 1 RepliesI would like to create a flash movie that loops through 11 dynamic images continually with a fade-in, fade-out each image.
View 2 RepliesShouldn't flash detect these before running the script and crashing and having to force quit and restart (and flash startup takes a while)? Like just give an error: infinite for loop or something? And this happened to me a bunch when working with for loops within for loops, when I accidentally used the same variable for both loops, so of course it never ended and crashed flash.
View 2 RepliesThe scenario is to create a lotto game that matches 6 user inputted numbers with 7 randomly generated numbers. The 7th number is a special case (eg bonus ball) WOULD LIKE TO SHOW A KIND HEARTED FALSH GENIUS ALL OF THE SCRIPT IF POSS! (its not tooo long) This code works, but it just outputs the default message: There seems to be a problem with my arrays not comparing? Part of the code is: (prioir to this the user inputs numbers, they are copied to text areas beginning with O, on a button press) On a second button press randomly generated number appear to a timer. //compareResult checks how many numbers match between the two sets of numbers to determine winnings.
[Code]....
I'm new here and I'm wondering if I can use the Sound Loops for commercial uses?
View 3 RepliesI have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....
However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....
TypeError: Error #1010: A term is undefined and has no properties.at Function/<anonymous>()
I'm pulling data from an xml doc and created 4 XMLLists to hold the children of the 4 different elements. Inside the onLoad function, I created a series of for loops to go through each list. But Flash stops after going through the first two. I'm very puzzled by this. I got around it by creating a 2nd onLoad function for the last 2 lists, but should I be using a different loop? Curious.. I inserted a break after the first 2 and then the 3rd loaded up...
View 1 RepliesI've got the following code and i would like to add an delay of 200 ms after each trace statement
for (var x_pos:uint = 0; x_pos <= 12; x_pos++){
for (var y_pos:uint = 0; y_pos <=12; y_pos++){
trace("hello world " +"("x_pos+","+y_pos+")");
[Code].....
i am new to flash and i was wondering if there is a way to slow down for loops.Like i can set how many seconds till it goes and loops again. I have tried setInterval but didnt work.here is my code:[code]
View 10 RepliesMy situation is that in the game I'm making, I have a movable turret firing duplicated bullets. I need to hittest them against a duplicated set of oncoming robots. I've tried using a for loop, but I just can't get it to work.I've attached the .FLA, and I would be grateful if anyone could point out what I'm doing wrong (ignore the values for removing the clips and the random duplication; I had to shrink the stage size to make the file size smaller!)
View 3 Replieswhy this code dosent work at the same time in the timeline, and why only envent put inside the attacHMovies or duplicated Movies work, if i put them in the forr loops they don work.
Code:
img01 = new Array();
img01 = ["001.jpg", "002.jpg", "003.jpg", "004.jpg", "005.jpg", "006.jpg", "007.jpg",
[code].....
I would've thought of a better title but I honestly have no idea what's going on. I have this code on the main timeline:
Code:
dots = new Array();
for (i = 0; i < 10; i++) {
[Code]...
I want to attach a MC dynamically so that I have 12 rows and 12 columns of _mc box on the main stage:[code]I think it can be done only with a nested loop but so far, well, my head's in a loop!
View 11 RepliesCode:
var cityArray:Array = new Array();
cityArray[0] = "southland";
cityArray[1] = "otago";
cityArray[2] = "westland";
[code]....
What have I done wrong? I'm trying to give each mc it's own number based on the name position in the array etc etc - It returns 18 for all of them when I click them one at a time.
Why nested loops must be used. I have this code that I took from the Training from the source book:
v = 0;
i = -1;
while(++i < 2){
j = -1;
while(++j < 2){
[Code] .....
What I don't understand is why I have to have this to create two columns couldn't I just change the while (++i < 2){ to
while(++i < 4){ instead.
way to slow down for loops. Like i can set how many seconds till it goes and loops again. I have tried setInterval but didnt work.here is my code:
on (press) {
enemmyX = this._x;
enemmyY = this._y;
[Code]....
We have a For Loop that duplicates and movie Clip.
for (counter=2;counter<=15;counter++) {
duplicateMovieClip(enemy,"enemy"+counter,counter+1 00);
}
On a hit test we want to remove all the duplicated movieclips. I acomplished this using a new scene with a frame action contianing another For Loop and a remove movie clip action. Hit test true move to new scene play frame action.
for (counter=2;counter<=15;counter++) {
removeMovieClip("enemy"+counter);
}
This worked.Is there a way to put a stop of the For Loop or Put a stop on the Duplicate movie clip?
I am trying to make a sound crossfading between the loops (an example would be: same as in a "Winamp" media player you toggle the Crossfading function in a Modern Skin and select a duration of it). Say I got a loop of 10 seconds, altho it is not perfect as its cut of the song without a proper editing tool. Any way I could accomplish it by using the ActionScript?
View 2 Replies