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


Similar Posts:


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 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 2.0 :: Shorten Multiple "if" Statement To "for"?

Jul 23, 2004

How do I shorten this into a "for" statement?

onClipEvent (enterFrame) {
var bttn = "0";
if (_level0.bttn == "1") {
_level0.mask2._y = _level0.btn1._y;

[Code]...

View 2 Replies







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