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
View 1 Replies
Similar Posts:
Apr 24, 2010
I've solved this problem in AS2 but I can't seem to sort it out in AS3.[code]...
View 1 Replies
Jun 23, 2009
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...
[Code]...
View 1 Replies
Feb 18, 2012
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.
View 1 Replies
Jun 3, 2009
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?
[Code]....
View 3 Replies
Jun 23, 2009
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...
ActionScript Code:
stage.addChild(zone[0]);
zone[0].x=267.6;
[code]....
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?
View 1 Replies
Sep 28, 2009
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;
[code]...
View 0 Replies
Mar 15, 2012
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.
View 2 Replies
Jun 17, 2011
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.
View 2 Replies
May 20, 2005
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.
View 2 Replies
Aug 13, 2008
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:
Code:
interval = setinterval("dothis", 2);
var increment=0;
function dothis(){
attachMovie(movieICall, "movieICall" + increment; 1)
movieICall._x = ;
_y= etc;
increment++;
}
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.
View 1 Replies
Dec 10, 2004
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?
View 8 Replies
Oct 31, 2010
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.
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.*;
import flash.events.MouseEvent;
[code]...
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.
View 1 Replies
Apr 27, 2003
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)
View 3 Replies
May 13, 2011
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?
View 1 Replies
Aug 21, 2007
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].......
View 1 Replies
Jul 28, 2011
If I have 16 buttons inside a for loop, how would I trace back the number that was pressed.
NumPageButtons = 16
for(i=1; i<=NumPageButtons; i++){
tempMC = eval("page"+i+"_mc")
[Code]......
when I do a trace it gives me 16 not the number (current button ) that was pressed
View 1 Replies
Jan 18, 2011
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.
View 1 Replies
Mar 29, 2011
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.
View 1 Replies
Jun 29, 2006
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...
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
Jan 18, 2010
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.
View 1 Replies
Jan 6, 2010
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.
View 6 Replies
May 11, 2009
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
clearPage();
setupPage();
drawSquares();
[code].....
View 5 Replies
May 6, 2009
How do I start to program with 3 objects on my page:
"logo_mc", "menu_mc" and "container_mc".
I'd like to put them on correct order when the stages grow (it depends of wich user's screen).
But how does it work? With 3 objects, I mean resize logo, the container and the menu..
View 1 Replies
Jan 14, 2010
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] .....
View 2 Replies
Apr 27, 2009
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.
View 1 Replies
Jan 21, 2012
I am new in flash so this question can sound stupid
I am about to create my first drawing in the adobe flash of some creature.
The problem is CAN i resize it when the flash is running (in runtime) by the end user.
Example: I want to increase the height of the creature.
View 1 Replies
Jan 14, 2010
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.
View 0 Replies