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


Similar Posts:


ActionScript 3.0 :: Tertiary Class Not Listening To Keyboard Events?

Oct 30, 2010

Here's my code: [URL]
 
I'm using Flash Develop.
 
The trace command never gets executed. Why?

View 9 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 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 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

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 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

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

ActionScript 3.0 :: Like Or Contains Operator ?

Aug 11, 2010

Looking for an operator in AS 3.0 that will work as a like or contains operator. Trying to create a search field that looks for a value (keyword) when a person types in a question in the text box.When it finds this key word it will then play a video. So if they type in "What are your training options?" It will look for train and play an flv file for our training courses.

View 3 Replies

ActionScript 3.0 :: Where Is The Or Operator On The Keyboard

Oct 17, 2010

I am going though a tutorial were I need to us an or operator its showing it as two vertical lines? How do I input that? I can't find anything like it on my keyboard and in the book it just mentions that the two lines represent the or operator and not how to even put in in the code?

View 3 Replies

ActionScript 2.0 :: OR Operator, Using Correctly?

Jan 17, 2005

why doesn't this work?

[code]...

basically in english, i'm trying to say that:if color is equal to purple or orange or brown then do this, else if color is equal to red or pink or green, then do this.the error the above code is having is that, no matter what _root.currentSection is, it always goes to the first if statment, so leads me to believe i'm using the || operator wrong.

View 2 Replies

ActionScript 2.0 :: How To Randomize Operator

Mar 1, 2003

I'm trying to get flash to randomize an arithmetic operator from a set of operators, i.e.operators = + - * / etc and I want flash to randomly pick one from the list!How do I do this? I looked at the random tut on kirupa but I don't know how to make it work with anything other than numbers!

View 12 Replies

ActionScript 2.0 :: OR Operator In If Statement

May 18, 2005

I'm trying to check to see if all the other movieclips on the stage are on frame 1.If they are, then on release of this button go to and stop on frame 2 of a specified movieclip. If any of the conditions in the if statement are false (any of the movieclips are not on frame 1) then I want to send all of the movieclips on the stage to frame 1 and then send the specified movieclip to frame 2.The code that I am using is below.I have placed this code on the instance of the button and all the movieclips and button are on the main stage.[code]

View 1 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

ActionScript 2.0 :: Use A Plus Or Minus Operator?

Jan 7, 2009

Is there any simple way to use a plus or minus operator in AS2? To give this context, lets say I want to randomize a speed, higher or lower, on event (passing a certain x or y value) (like a ball bouncing around in a bounding box,but create some random rebound angles).I'm essentially asking if there's anoperator for the symbol '�' in AS2...

View 3 Replies

ActionScript 3.0 :: GetChildAt And Is Operator?

Apr 15, 2012

From a position on an Array of sector Sprites on an 11 x 11 grid, I am trying to "sense" what Child occurs at nearby sector Sprites. I felt certain I could use something like this

if (sectorArray [currentSector - 11].getChildAt is MovieClip) {
//do stuff
}

but it doesn't seem to work. I changed my visibility settings to true, thinking the false visibility might be a problem, but no result.

View 9 Replies

ActionScript 2.0 :: OR Operator Using Correctly?

Jan 17, 2005

why doesn't this work?

[Code]...

basically in english, i'm trying to say that: if color is equal to purple or orange or brown then do this, else if color is equal to red or pink or green, then do this. the error the above code is having is that, no matter what _root.currentSection is, it always goes to the first if statment, so leads me to believe i'm using the || operator wrong.

View 2 Replies

ActionScript 1/2 :: Preventing Concatenate Using '+' Operator

May 27, 2009

How can I prevent concatenating when using the addition operator? totalCost_txt.text = (firstCost_txt.text + secondCost_txt.text)I can replace the "+" with any other operator and it works. (huh?)

View 3 Replies

ActionScript 3.0 :: What The %= Operator Does In Simple Terms

Oct 22, 2009

what the %= operator does in simple terms?Like for example what is it doing in the code below:
 
var durationSecs:Number=Math.floor(meta.duration);var durationMinutes:Number=Math.floor(durationSecs/60);
durationSecs %= 60; durationMinutes %= 60;

View 2 Replies

ActionScript 1/2 :: Use != Operator For Just Part Of The Text?

May 2, 2010

I would like to use a simple if statement.
 
if(filenametext!=".jpg"){
}
else{ bla bla bla}

[code]......

View 1 Replies

ActionScript 3.0 :: Convert A String To An Operator?

May 26, 2010

Is is possible to convert a string (i.e. "+") to an operator which I can use for a mathematical statement?

View 4 Replies

Flex :: Use Conditional Operator In Checkbox Using It?

Oct 21, 2009

I want to fill color based on condition so I used conditional operator for the checkbox. But it's shows the error Implicit coercion of a value of type String to an unrelated type Array. What did I do wrong ? How can I dynamically change the color of a checkbox ?[code]...

View 2 Replies

Flex :: Combine Two Images Together Using The XOr Operator?

Oct 28, 2010

Isn't there some way to combine two images together using the xOr operator? I realize I can step through pixel by pixel, but with all the graphics options available to Flash, I am reluctant to take such a ham-fisted approach. How can this be accomplished efficiently?

var pixel1:uint;
var pixel2:uint;
var xorMergedPixel:uint;

[Code]....

View 1 Replies

Flex :: Alternative Behaviour Of && Operator

Mar 9, 2011

I've faced such situation. I've used to program in C#, and such code:

[Code]...

was asking both, condition1 and condition2 to be true (the case when they both are giving false and the end-result is true, could be achieved in other way). In Flex, same code would perform "some actions" if the both conditions are false. I just was wondering if is there any chance to make it break after finding first false in a queue, or I have no choice and should write nested if's?

View 2 Replies

Actionscript 3 :: Define A Custom Operator?

Mar 16, 2011

How can I define a custom operator - for example equality operator - for a custom class?

View 1 Replies







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