ActionScript 3.0 :: Shorten This Logic By Putting It In A For Loop?

Dec 2, 2010

I have the following code below. Is there any way to shorten it by putting it in a for loop. I want all values to be false, apart from go2 which will be true

Code:
var goArray=[go1,go2,go3,go4, go5];
var go1:Boolean=false;
var go2:Boolean=false;[code].....

View 9 Replies


Similar Posts:


Actionscript 3.0 :: Shorten Code With Conditional Logic?

Jan 31, 2010

I want to shorten this piece of code with conditional logic:[code]But i keep getting this error - TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 4 Replies

ActionScript 3.0 :: Shorten Some Lines Of Codes With A For Loop?

Jun 17, 2008

ave some lines of code that i would like to shorten.

View 5 Replies

ActionScript 2.0 :: Putting Buttons Through For Loop?

Jul 23, 2009

I don't have an incredible amount of experience with flash, but I feel like I'm missing something really obvious here. I have about 10 buttons here (although I only show two in my code), and rather than listing out long lines of code, I figured it should be relatively straightforward to put it in a for loop...but its not working for whatever reason.

Rather than do

ActionScript Code:
hide = function () {
account_btn.enabled=false;
account_btn._alpha = 0;

[code]...

View 0 Replies

ActionScript 2.0 :: Putting _level In A For To Do Loop?

Apr 28, 2010

Loading stuff in levels ( MovieClipLoader.loadClip(picOrSwf, 1); ) and want a -for to do- loop to make them all _visible = false; but can't get it to workfor (i=0; i<total; i++) { _root[_level+i]._visible = false; } is the closest I got. (_root[_level+1]._visible = false; DOES work, but is no good of course).Let me know if this outlines my problem goo

View 4 Replies

ActionScript 2.0 :: Putting A Loop "on Hold" Until User Input?

Aug 3, 2007

i have a loop that moves a game piece every time a dice is tossed using tweens (i loop the movement the amount that comes out on the dice). it all works fine.

the problem is that when mid movement i need to ask a user a quesition with a popup movie with buttons that would determine the movement - i cant pause the loop.

basically i need to know how to put a loop on hold until further user input

if i have a loop that increments a number by one until it hits a predefined amount- i want to pop up a menu that would ask the user if he wants to continue incrementing the number by 1 or by 2. I still want the loop to run a total set amount of times (lets say 100)

View 1 Replies

ActionScript 2.0 :: How To Shorten This Scripts

Aug 10, 2007

I have some scripts that almost doing same thing, but just different buttons, how should i shorten it down? Cause i would have a lot, damn lot function to write :s*the buttons are not dynamic created so i would be easier to do some other stuff.

Code:
lv1_bsp1.onPress = function() {
shop1();

[code]....

View 1 Replies

ActionScript 3.0 :: Way To Shorten The Length Of A Target Name?

Apr 18, 2011

Is there an easy way to shorten the length of a target name? As you can see in the code below I have added "_snd" to "e.target.name".

Let's say "e.target.name" equals "square_1" so the code below returns "square_1_snd", when the square is clicked on.

What I want to know is how do I get "square_snd" to return?

I would think if you can do (e.target.name + "_snd") then you could do (e.target.name - "_1" + "_snd"), to get just (square_snd), but it doesn't work.

I'm sure .split() and .join() is what I need to use but can someone show how to use it in the code below?

Actionscript Code:
var ClassReference:Class = getDefinitionByName(e.target.name + "_snd") as Class;   var mySound = new ClassReference();     mySound();

View 1 Replies

ActionScript 3.0 :: Shorten Long If Else Statement?

Feb 9, 2012

How can I shorten this if else statement which just simply counts up? I know there's gotta be a way. I tried a for loop in the middle of it but I couldn't get the syntax right.Basically, it compares a date range that is in an array and then loads the correct banner by date from an xml file. It's part of a scheduled banner system controlled my one xml file. It has to have that else fallback at the end.[code]

View 6 Replies

ActionScript 2.0 :: Use The 'tertiary Operator' To Shorten?

May 31, 2003

is there a way to use the 'tertiary operator' to shorten this code?

[AS]if (this._x<0) {
this._x = Width;
}
if (this._x>Width) {
this._x = 0;

[Code]...

View 5 Replies

ActionScript 2.0 :: [FMX] Shorten Movieclip - Cut Down The Number Of Frames

Mar 12, 2004

I have a movie clip that is about 80 frames. It just cycles through 4 pictures at 20 frames per pic. I want to use actionscript so I can cut down the number of frames. I thought I could use a while loop to do this. Here is what my code looked like:

[Code]...

View 9 Replies

ActionScript 1/2 :: Shorten / Optimize Repetive, Long Code?

Sep 30, 2009

my code works, but is way too long, infact to get the result I want it would need to be very very long.Here is *some* of my code, this is for Left. I have 3 other similar bits of code for Up, Right and Down.

on (keyPress "<Left>") {  _root.player.gotoAndStop("left"); leftFunc = function () {  if (_root.player.hitL.hitTest(_root.everything.hitAll.hitLeft) || _root.player.hitL.hitTest(_root.everything.hitAll2.hitLeft) ||

[code].....

View 7 Replies

Professional :: Shorten Blank Frame Ends In Timeline?

Dec 12, 2010

I'm using Fl for the first time and I'm trying to create a slideshow. Everything was going fine until I realized I had spaced out the different image timelines too far to the right. Now that I've moved them all leftward I have these blank ends that make the slideshow end with a long empty nothing. How do I cut those timelines off to eliminate that dead time?

View 3 Replies

ActionScript 3.0 :: Shorten The Delay When Press And Hold A Button To Performing The Action?

Dec 11, 2011

So if you press and hold a button, it does the function once, then waits 0.5 of a second or so then repeats the action quickly. How do I remove the 0.5 of a second wait?

View 3 Replies

Php :: The Logic Of Ecards?

Dec 9, 2011

Would like to understand the basic process behind an ecard before I attempt to construct one!Obviously there could be the following elements:Initial web page containing a Swf (choose swf) offering a user a choise of ecards and a consisting of a series of text input fields to collect recipients and senders address and a message. With actionscript that calls a php file on the server.

Passing variables holding the card choise the card text the email from and to etc from swf to php file.The php script runs and creates a copy of a swf card, the one chosen by the user(swf1) It populates the swf copy with text from the variables set by the choose card swf.the php then sends an email to the recipient address with ? and this is where I am unclear?Does it send an attachment of the swf1 or how does it do it?

View 2 Replies

ActionScript 2.0 :: Concerning Logic Operator -=?

Sep 19, 2005

Im doing a tutorial in a book that moves a car from one end of the screen to the next by buttons.When you release a button it moves the car 10 pixels more down the X axis.The code confuses me and I want to understand it Please Help!

Here is the code:

// stop the cars traveling
stop();
// callback for onPress event on 'back' button
back_btn.onPress = function() {
// move my car -10 pix

[code]...

Why does the - sign and + sign appear before the = instead of after?Is this a logic operator(-= or +?Why doesn't putting the - sign or + sign after the = work?

View 2 Replies

Silverlight :: Logic Not On The Presentation Tier

Jan 19, 2011

In a RIA application you are supposed to put as much business logic as possible outside of the RIA layers (flash/silverlight etc). What is the reason behind this? Any logic that goes into the presentation tier gets the benefit of executing faster...

Is this because the RIA technology will most likely need a face lift down the road and you will have to rewrite all the business logic?

View 3 Replies

Flash :: Logic For A Matching Game?

Feb 5, 2011

I was given a task to make a match making game in actionscript 2, problem is, i have very little knowledge about the language (well, and how matching works in as2, what are the important codes, code emplacements, and all I am new in AS2, and i really need a lot of help with our project. :)

I plan to match images. But.. I was planning to have a sort of "Compatibility" match-up game, like,..let's say we have two batteries, one has a 50v capacity(how do u measure batteries?) then the other has a 100v capacity, then there's this battery slot that only accepts a 50v battery, then you will have to match this 50v battery to that battery slot, that's my concept for the game, sir. I hope you got what i said, sir. :D

View 1 Replies

ActionScript 3.0 :: Missing Logic In ColorTransform?

Aug 26, 2009

i missed something in the Aplly of ColorTransform, but i can't see...I made a background for the menu buttons that changes depending to the container x position.the problem is that it changes the text color too, and I don't figure why... here is the code :

Code:
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;[code]......

View 2 Replies

ActionScript 3.0 :: Where To Place The Logic (OOP Related)

May 3, 2010

I want to update 50 "Circle sprites" (sprite with a circle in graphics object) on a timer event. Each circle's radius and position is calculated with a formula based on preloaded xml data.

[Code]....

View 4 Replies

ActionScript 3.0 :: Complete List Of Logic Errors?

Jul 9, 2009

Where I can find a complete set of Flash CS3 logical errors and what they refer to? I know Adobe has a list but for some reason it is incompelete.

View 2 Replies

Flex :: Sharing Logic Between The Browser And The Server?

Oct 19, 2009

I'm working on an app which will, like most apps, have a whole boat load of buisness logic, almost all of which will need to be executed both on the server and the Flash-based client And I'm trying to figure out the best (read: least complex) way to implement the rules engine.

These are the parameters of the problem:

The rules engine must both run in a web browser (ie, in Flash Player) and on the server. Duplicating the logic (eg, by writing a "server" version and a "client" version) would be an unacceptable risk. The input/output data is fairly complex, so serialization is a nontrivial problem. We are currently using AMF for all of our serialization needs, and using another protocol would add significant complexity So it should probably be avoided. It is infeasible to implement a "rules description language". Experimentation has shown that rules are sufficiently complex that any such language would need to be Turing complete Which would also add a significant amount of complexity. The rules engine will not need to make some, but not very many, service calls.

Currently, the best contenders are:

Writing the code in ActionScript, then running it on the server. In theory it's possible to start up an AVM instance, get it long-polling a gateway, then pass data back and forth that way But that seems less than ideal. Writing the code in haXe. I don't know anything about haXe's AMF support, so that could be a deal-breaker. Something involving Tamarin. Seems like a viable option, but I haven't done enough research to tell either way.

View 1 Replies

Actionscript 3 :: AI Opponent Car Logic In Car Race Game?

May 24, 2010

i want to develop AI car(opponent) in car race game what should be my direction to develop them with less complexity because i don't have any idea. because the player car is moving on the scrolling track plz suggest me should i have to use relative motion or way point concept but that should also be change on the scrolling track (i.e. player car movement)

View 3 Replies

Flash :: Logic Error In Actionscript Code?

May 29, 2011

I have the following logic in my code

if((leftCombo.getSelectedIndex() !> rightCombo.getSelectedIndex())&&(rightCombo.getSelectedIndex() !< leftCombo.getSelectedIndex())

Doing something wrong obviously.Here are the errorsScene 1, Layer 'Layer 1', Frame 1, Line 112 1084: Syntax error: expecting rightparen before not.Scene 1, Layer 'Layer 1', Frame 1, Line 112 1084: Syntax error: expecting identifier before logicaland.Scene 1, Layer 'Layer 1', Frame 1, Line 112 1084: Syntax error: expecting semicolon before not.

View 2 Replies

ActionScript 3.0 :: Design Logic Gates Using Flash?

Mar 22, 2011

how to design logic gates using flash?its a part of a project

View 4 Replies

ActionScript 2.0 :: Figure Out The Mini Putt Logic?

Apr 11, 2006

I am trying to figure out the mini putt logic.. I understand that you give an angle and force then hit the ball. Now, once it hits a border, is it : the straight angle of the border minus ou plus (depending on the side) the angle of the ball that gives us the bounce angle? Any tips/formulas welcome

View 2 Replies

ActionScript 2.0 :: Logic Error Or Flash MX Limitation?

May 6, 2002

This is my problem that I have been fighting for way too long. I have a grid with some 300 boxes in it. I want these boxes to populate the grid randomly with random number of boxes populating each time.

My grid is a MC and all of the squares in it are the child of a another MC. All squares are named 1-300 and as you can see in the array, I am testing just 18 right now. I am hoping that it is possible to do what I want to do with an array because I think it would save me a lot of time and save computers a lot of processor juice.

I have been able to get the setProperty to affect the squares that the array points to, but it won't move on to any other squares. Or it will make the entire MC invisible.

CODE for frame 1:
//This code should wipe the grid clean
Boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
for (count = 0; count<=18; count++) {

[Code].....

View 9 Replies

ActionScript 2.0 :: Image Placement Algorithm Or Logic?

Jul 31, 2010

I'm builiding some sort of data portfolio in a section of a website. The method i'm using is the next one:

- Load an XML with all the data
- Call a function to build the portfolio.
- Use a "for" within said function to place all of the images at their respective positions

So, what I'm trying to achieve is to place the all of the nodes at the same time on and off screen following the next pattern:

[Code]...

View 1 Replies

ActionScript 3.0 :: Flash Math.random Logic?

Aug 11, 2010

@ 1) I have a big problem with Math.random logic in the animation on the top of this website ( danceacademy.cz ). If you leave it for lets say 3 minutes it'll start breaking (see for yourself please).
@ 2) Also animation shows mostly the Yemi guy which is undesirable behavior . That's because he is on the end of the code ( else { // In case the random number is 1 myMainMovieClip = new yemimain(); )

[Code]...

View 1 Replies

ActionScript 3.0 :: Shorten The Length Of "e.target.name"?

Apr 18, 2011

shorten the length of a target name? As you can see in the code below I have added "_snd" to "e.target.name".Let's say "e.target.name" equals "square_1" so the code below returns "square_1_snd", when the square is clicked on.What I want to know is how do I get "square_snd" to return? I would think if you can do (e.target.name + "_snd") then you could do (e.target.name - "_1" + "_snd"), to get just (square_snd), but it doesn't work.

PHP Code:

var ClassReference:Class = getDefinitionByName(e.target.name + "_snd") as Class;
var mySound = new ClassReference();
mySound(); 

View 5 Replies







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