ActionScript 3.0 :: Simple 'for Loop' To Simplify?
Apr 3, 2011
im a complete noob. how would i get this code into a simple 'for loop' to add 3 sprites named heart1, heart 2 and heart3. basically to simplify this mess
ActionScript Code:
var heart1:Sprite = new Sprite();
with (heart1.graphics) {
beginFill(0xFF0000);
drawRect(0,0,20,10);
[Code]...
View 4 Replies
Similar Posts:
Aug 9, 2010
how can i simplify this code:
PHP Code:
stop();
import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;[code]........
I think, for loop can be used but i don't know how
View 1 Replies
Jun 21, 2008
I have this switch and I know there must be an easier way to accomplish this. For example if the user selects something it sets that button to a certain frame in this case nSelected, and sets all other buttons to a frame labeled nDefault.[code]...
View 4 Replies
Mar 1, 2010
im having dramas making this flash loop back to frame 39 in the AS3 i have attached the zipped fla its cs4
View 1 Replies
Oct 29, 2009
For each product a label is created determing its category unless a label of that category has already been created before. My while loop is supposed to stop the same label being created twice but apparently it doesnt! My function consists of an array of categories (kategorie[]) and an array of labels that were previously created (previousLabels).
[Code]...
View 4 Replies
Nov 23, 2010
I'm an AS2 convert and struggling. I can't figure out how to get my function to see my array. I keep getting an error that "i" is an undefined property.
var thingsToShrink:Array = new Array(
b1,
b2,
b3,
b4,
b5
);
function shrinkBars(myArray:Array){
for (i=0; i < (myArray.length); i++){
myArray[i]._yscale = 0;
}};
shrinkBars(thingsToShrink);
View 4 Replies
May 27, 2003
I'm trying to make a simple for loop that makes a line move. But it won't work, and when i search for "for loop" it gives me all these dynamic things that are WAY over my head.[code]The way i see it, the i should increase by 1 each time the loop is run, and then the line will move up by 1 until it is at x = 0 (it starts at x = -77). But when i preview it in flash and html, nothing happens at all.
View 6 Replies
Jan 14, 2012
I have looked everywhere for an example or tutorial on a delta time game loop in AS3. I found many fixed time step examples but very little helpful information on delta time game loops and how it works. I have seen examples that do the calculations in a timer and also seen examples that do the calculations inside the enter_frame event. All the examples I have seen are also incomplete and only provided me with bits and pieces.
View 3 Replies
Jul 21, 2010
Im trying to make a simple Image loop for a home page of a website.
I have flash loading the images dynamically thru loadmovie
the Images load fine, but they go on top of everything else.
Is there a way to get them on a lower layer?
View 3 Replies
May 26, 2009
I have an animation that has roll overs controlled by AS (see code below). It works the way I have the code, but it's really messy code. And I hate that I'm have the functions rewritten for each event.How can I simplify this code?
//On the main timeline
var gearsEnabled:Boolean = true;
var gears2Enabled:Boolean = true;
[code]....
View 4 Replies
Jul 11, 2009
I have a test here which is for a more complex interaction, but the principle is the same. What I would like to know is how to make the code more efficient, possibly through array loops?
View 5 Replies
Feb 14, 2007
Been reading up on the flash transition object. I came up with this way of fading out one clip and fading in another and having them loop forever using the transition objects but it's very dirty coding and not very flexible.
Is there a way to clean it up so that I can add as many clips as I want without having to write more code, just by adding more movie clips to the stage?
[Code]...
View 2 Replies
Aug 25, 2009
I've set up a simple enter frame loop to adjust the alpha on a grid of movie clips ("bubbles") using a distance formula from the mouse pointer.I've got a hunch that while this works fine, there's a more efficient or processor friendly way to do it.
grid of mc's created here....and pushed into an array
stage.addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void{ for each (var j in bubbArray)[code].....
View 1 Replies
Dec 16, 2010
I have this code that's repeating for 40 different instance names that play 40 different movieclip names.
Is it possible not to repeat all this code for every instance name? For example creating a function that catch the instance name that is pressed and plays the correct moviclip name?
[Code]...
View 4 Replies
Oct 4, 2009
i have an application in which i have around 100 textinputs all are numbers
i want to simplify the addition ie. any other way than saying txt1.text+txt2.text.....
that would increase my code a lot
is it possible to have (n+=txt*.text) or some thing like that
View 1 Replies
Dec 8, 2009
There are 3 properties (example 1):
[Bindable] public var name:String;
[Bindable] public var email:Number;
[Bindable] public var address:Boolean;
I needed to have 3 helper methods that will be bindable too (example 2):
[Bindable] public var name:String;
[Bindable] public var email:Number;
[Bindable] public var address:Boolean;[code]......
View 3 Replies
Dec 16, 2010
I have this code that's repeating for 40 different instance names that play 40 different movieclip names.Is it possible not to repeat all this code for every instance name?For example creating a function that catch the instance name that is pressed and plays the correct moviclip name?
Code:
pressed=false;
clic=null;
[code].....
View 3 Replies
Nov 15, 2011
Last week I made a class to simplify rollOver and rollOut event of a button based on MovieClip with ENTER_FRAME event. It works well but I'm not quite sure this is the best class, since I'm new in AS3 Classes. Now, if you don't mind to take a glimpse of my class.
Here is the class
Code:
/**
* VERSION: Early
* DATE: 2011-11-15
* AS3
[code]....
View 2 Replies
Sep 28, 2009
simplifying this piece of code right here using "for (i=0,i<numberOfArtists,i++) ;in order to make it dynamic by passing a variable for the amount of artists via XML.
labelArtist1.sideArtistsList.gotoAndStop(1);
labelArtist2.sideArtistsList.gotoAndStop(2);
labelArtist3.sideArtistsList.gotoAndStop(3);
[code].....
View 1 Replies
Aug 1, 2011
Flash is not in my toolset, but I am an old Director jock and have spent some hours dipping my head into the Flash manual. I suppose that makes me a promising beginner-level poster. I'm working in CS5.
I need to make a simple Flash-based sound player for a website for a newly-released novel (http://www.bearriverbooks.com/index.html). I want the user to click on what appears to be an icon (or image), which kicks open a simple controller and starts playing a sound file (a radio interview, which I will probably export using Flash's voice compression). Nothing fancy. Just want the visitor to hear the sound and be able to apply simple controls (stop/start/rewind/volume).
I can learn ActionScript, I suppose, since I used to dream in Lingo, but my life would be a lot simpler if I could just publish a controller without having to roll my own. I'd like to think there's a magic button somewhere that can do this, but I haven't found it yet.
View 4 Replies
Jan 16, 2012
Are there any programs or features in flash that can simplify flash vector art?
I just realized that one of the reasons why my program might be running so slow is that I made the images out of lots and lots of circles. When things didn't look right I often just put larger circles over smaller ones. I didn't think that flash might still be drawing the invisible circles underneath-
View 1 Replies
Apr 16, 2010
I would like to create a loop so the icons in the menu continually loop indefinitly.[code]
View 2 Replies
Dec 11, 2010
I am attempting to use a loop to create text field with the loop's current value. The code looks like this:
ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}
So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".
View 7 Replies
Jun 13, 2004
i'm trying to do an infinate loop for my m.clip.the looping part does not want to loop...it loops back to my firrst frame even though there are two same picture in the movie clip.....here's a sample of what i use for the infinate loop script..
[Code]...
View 2 Replies
Jul 20, 2009
I have need of loops / nested loops that pick different figures depending on where you are in the loop. The whole function needs to run through 'ml' times. 'ml' is a dynamic figure. Loop 1 = While the loop is within the first 12 iterations, 'exconemp' must equal 100. For iterations 13 - 24, 'exconemp' must equal 102.5, for 25 - 36 it will be 105.06, for 37 - 48 it will be 107.69. This needs to change every 12th iteration until it has reached 'ml'. The calculation takes the value of the previous 'exconemp' and then multiplies that by 0.025.
Loop 2 = While the loop is within the first 120 iterations, 'abc' must equal 0.015 and any further iterations must use 0.01. This must also work in a way to figure out whether 'ml' is higher or lower than 120 and work accordingly. My main issue is this - how do I get the loops to run through as this: While the iteration is < 12, do this, THEN take the final figure (12th iteration) and start on 13 - 24, do this THEN etc etc. How do I produce a THEN statement? I can get the code to pick up the final values, but not change along the way.
[Code]...
View 6 Replies
May 5, 2011
Say, I had a loop in a function...
[Code]....
How would I refer to a in another function
View 8 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
Jun 2, 2011
Recently I'd been criticized for structuring my for loops like so:
var i:MovieClip;
for each(i in array)
{
[Code]....
This reads better for me personally, yet I'm being attacked for it. Is there any difference?
View 2 Replies
Nov 29, 2011
basically I need a loop within a loop to compare two different arrays in my actionscript3 lottery game. I have attempted the loop but I cannot seem to get it to work ...
[Code]....
So basically within this code check_win is a button. Once the button is clicked it runs the loop. It is meant to take an instance of matches which contains 6 properties and loop until index is greater than matches. According to my output this is happening but the second loop doesn't appear to do anything.
View 1 Replies
Aug 25, 2010
How do i word a for loop to make it loop through multiple arrays?I want 1 for loop to loop through multiple arrays in order to move/alter objects.I want to keep the arrays separate.
ActionScript Code:
characters = new Array();
characters[0] = male;
[code]........
View 3 Replies