ActionScript 3.0 :: Simplify Code - How To Use Loop?

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


Similar Posts:


ActionScript 2.0 :: How To Simplify And Improve Code

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

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

ActionScript 2.0 :: Simplify The Code For Mouse Events?

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

Flex :: Simplify AS3 Binding/event-dispatching Code?

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

ActionScript 2.0 :: Default Simplify The Code For Mouse Events?

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

ActionScript 2.0 :: Simplify A Switch Case With A Loop And Array?

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

ActionScript 3.0 :: Simplify Functions An Variables?

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

ActionScript 1/2 :: Simplify With Array Loops?

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

Flex :: Simplify Adding Multiple Text Inputs?

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

ActionScript 3.0 :: Class To Simplify RollOver And RollOut Of A MovieClip?

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

ActionScript 3.0 :: Run Code At End Of Loop?

Mar 14, 2011

I'm creating a simple navigation from an MC (navBtn) in the library.The MC's are added using a loop with the text on the MC's coming from an array,(in the actual code it's from XML).When the loop has finished I wanted to create a final contact button using the same
MC in the library.I'm using an if statement to determine the end of the loop

Code:
if (i>=nameArr.length) {
navCon = new Btn();

[code].....

View 1 Replies

For Loop Code Migration?

Jul 21, 2009

I found this code in an AS2 .fla and would like to use it in AS3.  (The idea is to throw a random number of copies of the movieclip "star_mc" on the stage via AS). 
  
for (var i =0;i<50;i++) {
star_mc.duplicateMovieClip("star"+i,i,{_x:Math.random()*350,_y:Math.ra ndom()*150});
this["star"+i].gotoAndPlay(Math.random());
}

 I get this error message:  TypeError: Error #1006: duplicateMovieClip is not a function.
at many_fla::MainTimeline/frame1()

View 1 Replies

Flash :: Better Code For 2 For Loop?

Jul 9, 2011

I looking at a alternative coding which use two for loop, my code is require to overwrite the value in array b into a if b has a larger value than a, after break and loop a will continue point to the next index until it has the next 'mm' value while the loop b will resume from where it was "break"

[Code]...

View 2 Replies

ActionScript 3.0 :: Put The Code Into A For Loop?

Feb 26, 2011

Is is possible to put the following code into a for loop?

ActionScript Code:
box2.b1_txt.text=String(text1);
box2.b2_txt.text=String(text2);[code]......

View 1 Replies

ActionScript 2.0 :: [FMX] How To Loop The Code

Feb 9, 2010

to loop the below code:

Code:
Banner1.setMask(BannerMask1);
Banner2.setMask(BannerMask2);

[code]....

View 4 Replies

ActionScript 2.0 :: Using A For Loop To Streamline Code?

Jul 3, 2009

I have some AS2 code that has a lot of duplication to control various buttons and MovieClips and was wondering if it's possible to streamline this code using a 'for' loop, like I would when attaching MovieClips dynamically.Here's the code as it's currently written:

Code:
//----------- INIT VARS -------------------------
var color01:String = "0xE24C9B";

[code].......

View 2 Replies

ActionScript 2.0 :: Loop Code Not Timeline?

Dec 4, 2009

I'm creating a simple banner for my site. I found some cool landing confetti code but it seems like after it hits the keyframe with the confetti actionscript it stops and the rest of my simple timeline animations don't play. I just wanted to have a few type animations and a logo fade in and out while the confetti is falling. I removed the stop on the confetti frame and after I do that the animations play but the confetti doesn't work. This code is on the main timeline that causes it to stop

Code:
// pause after how many seconds
vSeconds = 11;
vFPS = 20;

[code]....

View 6 Replies

ActionScript 3.0 :: Use Each For Loop Code In Arrays?

Feb 9, 2012

I have a problem to use each code in for loop. I create 2 Circles in my stage with addChild code. And I gave them function ( mc.x += 2; ) and the time they get to the end of stage I gave the function ( mc.x -= 2; ) but my problem is when one of the circles get to end and wants to move to the right the other circle move with him to the right. and I think the each code in for loop helps me. but I don't Know how to use it in my actions.

my code is:

ActionScript Code:
var mc1:Circle = new Circle();
var mc2:Circle = new Circle();

[code]....

What should I change in this code to use each for loop..?

View 9 Replies

ActionScript 1/2 :: Code To Insert To Loop Slideshow?

Aug 4, 2010

i have a slidehsow and my code is as follows"waitSec = 5;setInterval(Timer, waitSec*500);//function Timer() {gotoAndPlay(nextFrame()); }stop();"it has 5 frames as i have 4 pictures in my slideshow.but i need to loop it so it can go back to frame 1 in my slideshow after frame 4also when i click on a button on my slideshow it will go to that image but then instantly go to the nexct image and then carry on as normal why ndoes it do that?

View 10 Replies

ActionScript 3.0 :: Loop This Code So The Animation Continues To Run?

Apr 1, 2011

This was originally a tween, i converted it to code and removed the tweens.[code]....How can i loop that so the animation continues to run, because right now it only runs once.

View 4 Replies

ActionScript 2.0 :: Play Frames In Loop With Code?

Jul 10, 2006

In my project i need a code wich allow me to play an animation (not a motion tween)it is a self hand made animation frames by frames.my animation start from frame 10 and finish in frame 15.I just need to play it from 10 to 15 in Loop when my mouse is over.and stop animation loop when my mouse is out.

View 3 Replies

ActionScript 2.0 :: Button.rollOver Code In For Loop?

Mar 23, 2004

I have three movieclips (used as buttons) on my main MC. The following code swaps the depth of a dynamically loaded image the when I rollOver each movieclip (button)I want to put the button.rollOver code in a for loop so I dont have to repeat this code for every image loaded.

[AS]
x = 150; // x location of image
Y = 100; // y location of image

[code]........

View 3 Replies

ActionScript 1/2 :: Repeat/Loop Small Amount Of Code?

Jun 28, 2009

how do I get this code to repeat itself continually, because it just executes once. Im not that good with listeners, i know functions and variable etc though im not that bad.

Code:
if (health<=0) { gotoAndStop("mainDead");}
Its on a frame, not a MC.

[code].....

View 3 Replies

ActionScript 3.0 :: Code To Loop A Movie Clip In Reverse?

Nov 4, 2009

I would like to loop a movie clip forward and reverse by selecting a forward or reverse button. I found the following actions script 3 code on Adobe however the code which plays the mc in reverse is not triggered by a button.[code]...

View 3 Replies

ActionScript 3.0 :: Delay Play Only Once - Code Executes Each Loop

May 5, 2010

I am new to flash. I can't seem to decifer the script examples in the help files. After a lot of trial and error the following codes works great. It delays playback on the video for the proper amount of time. The only problem is when the playback loops (like it should) the codes executes again. I only want to execute the code the first time thru.

[Code]...

View 6 Replies

ActionScript 3.0 :: Add Code To Get The Actions To Loop Like The Timeline Is Looping?

Jul 16, 2010

I am new to FLASH and have created a rotating banner for our website with 5 roatating images with 5 invisble buttons linking to 5 landing pages. And it works the first loop through.  However when it gets to action 5 for my last image, that link continues for all the buttons is subsequent loops.What do I need to add to my code to get the actions to loop like the timeline is looping? Code used for the links. This is the link that continues after the first run of the banner:

var url5:URLRequest = new URLRequest("http://www.facebook.com/MoDOT.KansasCity");, onStageClick5);
stage.addEventListener(MouseEvent.CLICK[code]....

View 1 Replies

ActionScript 1/2 :: Code For Movie Clip Array W/ Loop

Apr 11, 2012

I want to have an array that loops my movie clips.However, there also needs to be the ability for the loop to stop and play a specific movie clip when a specific thumbnail that corresponds to that clip is clicked on.Then, when that movie is done playing, the array is accessed again and the array continues once again, also looping.I don't even know if this is possible.I set up something that worked in Flash Catalyst, but the only problem is that FC doesn't have the ability to have a fullscreen button in it for the document.I need to be able to have the entire document go fullscreen when a button is pressed.I do not have Flash Builder.[code]

View 3 Replies

Actionscript 3 :: Write Code For Flash Game Loop?

May 28, 2011

Im making a transition from Java to Flash/Actionscript and Im having sort of a hard time figuring out where to write my code for my flash game loop(or engine) due to flash having "frames" unlike Java.Am I able to put the loop inside the Document class even having like game menus in the game? I havent found a way to put it in there without it always running when the flash application begins.Or should I just have the game loop called every frame? For instance, frame 4 will be level 1 and so the engine will be called out there. And frame 5 will be level 2 and ill call a different instance of the game engine there.Im just having a difficult time due to the "frames". So where would be the best place to put the game loop?

View 4 Replies

ActionScript 2.0 :: Loop Button Code Not Quite Right For Music Player?

Mar 26, 2011

I thought I had this one right until I listened a little closer. Below is the code that I am using to make a loop button for my music player. At first, using everything but the last line, seemed to work perfectly, until I realized that the music wasn't starting over from the very beginning. Basically I'm using a pause command, followed by a resume command to keep the pressing of the loop button from playing the song over itself, if it'scurrently playing. So in that respect, it works great. But when the song ends and estarts, it starts only from the point of the song when I pressed the loop button. So I'm trying to figure out how to make the 2nd time that the song plays and each additional time after that, play from the very beginning of the song. While still being sure that the song does not play over itself, the first time it's played.

Code:
loopbutton_up.onPress = function(){
mySongPosition = _root.mySong.position/1000;

[code]....

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved