ActionScript 2.0 :: Resize Multi Objects Through Loop & Incrementing Variable?
Jan 5, 2009
if i wanted to modify the xy size properties of several pieces of media through a looping function and an incrementing variable how could i do it? resize multi objects through loop & incrementing variable
I'm adding several similar movieclips to the stage with a 'for' loop. However, I'd like to increment the position of each movieclip when added on to the stage. I know exactly where I want each movie clip positioned as well. At the moment I just have a small 'for' loop which setups the movieclip. Like so...
When the user presses the space bar, I'm trying to take one string from a series of strings labeled c1-c9, break it into an array, display that array, and then increment the linenumber variable at the end of the function so that the next time the space bar is pressed, the next string in the series is traced and so on and so forth. Here is the relevant section of script (the strings and the linenumber variable have been declared earlier)
[Code].....
Every time I press the space bar, though, I just get the traces of the initial string and linenumber value repeated without any incrementing. I think it may have something to do with the "this" before the bracket in this line var displayarray:Array = this["c" + linenumber].split(" "); which I found in a code sample on some website and do not understand at all, but I get compiler errors if I try to join the "c" and the line number without the "this" there.
I create some movieclips dynamically through a loop and store them into an array. I add an event listener to all those movieclips. In the function to which I direct the listener I want to be able to get the loop variable value associated with each movieclip. For example if you click the movieclip that was created the first time the loop ran then you would get the value 0.
Hope I have explained myself well enough. Is it necessary to create a custom event class for this?
I'm adding several similar movieclips to the stage with a 'for' loop. However, I'd like to increment the position of each movieclip when added on to the stage. I know exactly where I want each movie clip positioned as well. At the moment I just have a small 'for' loop which setups the movieclip. Like so...
ActionScript Code: for (var i:uint = 0; i<=8; i++) { zone[i] = new Zone(); }
I then have a long list adding and setting each mc position on the stage...
Although I've just had a thought as I was typing that last bit of code. Will I need to setup a for loop for each row...so the y position remains constant and I just increment the x value for each movie clip, and then repeat this for loop for the next row with the new y coordinate?
I'm working on a flash movie that involves the use of rotating 3 objects in a matter that the first one moves 18000 degrees cw according to the value in the 'num' variable. The 2nd object rotates -1800 degrees. The third one rotates 180 degrees.
What I actually want to do is create a movie of the older analogue electric meters that had the 5 dials that represented each digit so if the far right dial moved from 0 to 5 the 2nd would move the opposite way to be between 0 and 1 and the third a hair to the right of '0' and so on in increments of 1/10.
When I run the below code the dials ( I currently useing jetplanes until I draw or locate a pointer image file as well as the circle with 0-9 marked off in it) stay on 500 and should be moving a bit since I have another variable that increments num by 1. I tried using the Timer event and would get several errors. I also know that the way it runs now doesn't work since num is going to be assign the same value of 18000 since I have it setup to gotoAndPlay(1) in frame 2. How would I be able to have it so that so it would increment without getting undefined variables. I also tried a for loop to increment the num but the stage would instantly show the end result after the loop was done.
code -------------- var num:Number = 18000; var i:Number= 0;
I basically have a text file with a username variable that assigns usernames to username1, username2, and so on. I would like to create a loop that checks to see if that username was created and if it was a conditional statement will follow. The problem I have is I want to do a loop with a counter(var i) and increment that counter in the loop and concat that with loginName to input that into a dynamic textfield labeled loginName1. (Actionscript 2)[code]I am using loadvars to load 2 text files, one has username and ip(username1 = blahblah ipaddress1 = blahblah and so on), the second file has an array that has ipaddress and data usage passed in an array. i want to check how many usernames there are and check the ipaddress of that username against the other file containing ipaddresses and usage.) I have everything setup, but im running into issues when writing a loop to check for username1, username2, and so on.
i'm trying to add values to a variable.[code]a simple drag and drop on a MC.i would like to store the X displacement when i drag. let say i have 30 in a variable wich store x position of myMC, if i drag the MC 200 units the variable should read 230 and so on.
I've followed several tutorials on how to do this, but my dynamic text box always returns a value of "Nan" when I try to increment it's value.I've been trying to use Code:_root.total = _root.total + 1;] in an on release function. Even if i managed to get this to work though, I still need to reuse the variable i'm incrementing within other calculations.
I have a script which places a clip on the stage (well, just off it), and rotates the clip and then tweens it to a certain x/y coordinate based on the rotation using TweenLite, and all of this on a setInterval of 2 milliseconds. That works well. Thing is, I don't seem to be able to set a unique name based on the clipname and an incrementing number. Basically (and this isn't the whole thing, this is just the general idea), it goes:
So when I set the interval to 2 seconds, it moves everything well and there are no problems. When I set the interval to 2 milliseconds, the clips only get just onto the screen before disappearing. I've tried creating a function to handle the x,y, tween. So I could refer to the clip with a "this", but it doesn't change anything. The only thing I can think of is that movieICall is not incrementing, and every clip on the screen is being referred to as movieICall, in which case the next case of x, y, tweening overwrites that last one and effectively kills the last one (but then why is it not just left sitting on the screen)? I tried adding an overwrite: false to the end of the TweenLite, but that only let the tween happen once and then...nothing.
I have a for statement, using an incrementing variable "a." A dynamic amount of herbs are generated, so here is the for statement. Code: for(a=1; a<_global.herbAmount+1; a++) { var herbMC = _root["herb"+a]; trace(herbMC); } When I trace "a," it traces 1, 2, 3 or however many numbers there are up to the global herbAmount number. When I trace _root["herb"], _level0.herb pops out. When I add "a" onto _root["herb"], undefined is traced....why?
I am trying to make a simple mp3 player using flash. The songs are loaded using an XML file which contains the song list. The following code is inserted into a new keyframe.
The problem over here is in the nextSong() function. I am unable to preserve the value of currentIndex. Although I am incrementing currentIndex every time the function is called, but the value remains unchanged.
man this site is awsome, i have learned so much. but unfortunantly i have run into a new problem. i have
for (f=0; f<10; f++) { duplicateMovieClip(_root.guy, "guy"+f, f); } for (s=0; s<50; s++) {
[Code]...
only problem is, is that when the movies get duplicated, the numbers aren't right (ive done some testing and found that it is almost as if it is keeping the same variable in all the loops as the same, and is running the loops backwards (wierd)) anyways, apparently i dont know the for loop as good as i thought. i have tried rereading the for explenation, but nothin is clicking as to what i am doing wrong. any help or explenation would be great. (also, as a side question/statement-when i duplicate movieclips, they dont keep thier instante name in the duplicated ones, which is bad becuase i need to do hitTest and other things with the duplicated movieclips. any help with this would be great)
I have exported a page from InDesign to FLA that contains an InDesign multi-state object (MSO) and when I bring it into Flash and export as a SWF, the MSP just cycles through all the contained images. There's an Adobe KB that states that this is a known issue and that ActionScript can be used to stop the MSO from cycling. Does anyone know the ActionScript used to stop this?
i want to do is loop through an array of items, Each item has an image attached to it. But i only want it to go onto the next item once the image has been loaded fully.I have this wicked code that was kindly donated of someone off this forum.Now i know that this is possible as i've seen it but i'm not sure how to do it.Is it possible to adapt the exsiting codes below to perform this task? this is the code i have at the mo:
step loader:
PHP Code:
function createList(array, i, line, width, count, row) { // if (i == array.length) {[code].......
I wrote a code for handling google maps in a multi touch table. On the map itself, I have a sort of button that, if touched, makes a tool bar show up. On the bar I have a slider and a button, both of them activated by touch events. My problem here is that when I touch objects on the bar, the touch event pass through the bar and it is fired also on the map below, making my map move. Uff, this is very annoying.
i am creating a isometric game looks something like farm ville and city ville..i almost done everything. but but problem is only with sorting depth. find the attached .fla. this code is working in certain situations but not every time.
How do I align a movieclip, which width and height is user-defined, inside another object (this one is static, though). Top-left alignment is easy, x=0 and y=0, but what about center, center left, bottom left, etc? Math(.round) i suppose, but how?I want an object (static) inside the movieclip (user-defined) to stay aligned to, for instance, the top right corner, similiar to the minimize, maximize and close buttons at the top right of your browser.. The height and width data is pre-defined by the user in another file.But that does probably not make any difference...
All I want is to create a line (which is part of a rectangle) with a certain height (60), which I can then resize to another height. This works if I do it by hand (or mouse ), but if I use AS3, the line (or whatever object I'm using) is too small. Not only that, but the bigger the enlargment, the bigger the difference! I have attached an .fla file that contains two examples:On the right a rectangle that is being created with AS3, on the left two lines, one is just a Drawing Object, the other one a copy of that and made into a MovieClip symbolach example will be enlarged (by 200px) and in each one you can see that this results in a gap between the end of the line and the control object (red). Also, I measured the length of the line and it is indeed to short.
what I'm trying to do is make a preloader that will preload about 20 external SWF files before it lets you get to my main file. I want to do this because my main file needs the SWFs to be ready to go once its done loading. I have looked around and i found a few ways to do this with the "if (loadedBytes>=totalBytes)" and the code loops back till the files are done loading... this would be just what i need but i cant seem to get it to work. the file just seems to start loading my files but does not loop and just runs the time-line even once i state what frames i want it to loop.
I got on stage a bunch of squares (sprites), so when the browser change size, I need to re-draw this squares and re-calculate max numbers of that can fit on the page, and so on..., my issue is I call three functions in the resizeListener
So this is loading images by looping through a xml file and displaying them on the stage... The images load fine only they're way too big. Problem is when I add .width to myLoader the images disappear all together.
ActionScript Code: var xml:XML; var xmlList:XMLList; var xmlLoader:URLLoader = new URLLoader(); xmlLoader.load(new URLRequest("data.xml")); var myLoader:Loader = new Loader; [Code] .....
I'm completely completely new to flash and the company I work for assumes I know it, even though I tell them I don't. But anyway, I was assigned to make a header that has a glowing star that flies in and becomes part of the logo. So i've done that and it looks decent. I made it just like an animation, working with individual frames, not tweens or anything like that (vocab I just learned).I need to resize it as a whole to 500 x 90 and I also need it to linger on the last frame (the completed logo) for about 10 seconds, then have the star shoot in again.
I have is as I add objects from other classes to the stage, is there a way to automatically add them to the resize event I have on the main stage to keep them in position in my fluid flash layout? Currently I am declaring all the variables in the project at the top of my primary class, adding them to the stage in the opening function, and then finally adding them to the resize event.