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


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 :: Remove Equally Spaced Elements From An Array With Length Of 'n' To Match A Given Length 'y'?

Mar 9, 2011

Let's say I have array foo and a positive integer y, where foo.length > y.I want to remove elements from foo so that foo.length becomes y (or very close to it).Also, I need to preserve the first and last element of foo. The indices of the removed elements must be spaced apart as equally as possible. Foo can be sliced, or it can be used to create a new array.

Example: if foo = [a,b,c,d,e,f,g,1,2,3,4,5] and y = 6, then trimmedfoo could be [a,c,e,g,2,4,5] or maybe [a,c,e,2,4,5], but not [a,c,e,g,2,4] because the last element of foo is missing.

View 4 Replies

Actionscript 3 :: Variable Length Argument Expand To Call Another Function With Var Length Args?

Dec 22, 2011

how to do this

function foo(x:*, ...args):* {
}
function bar(x:*, ...args):* {[code].....

how to expand args ? when I call bar(1,2,3), I wish it call foo(1,2,3), but it call foo(1,[2,3])

View 2 Replies

Actionscript 3 :: Function.length And Variable (...rest) Argument Length?

Apr 19, 2011

Is there any way to determine if a (anonymous) function has defined the ...(rest) parameter in ActionScript 3? I know there's the function.length property, but it only counts the explicitly defined arguments.

View 2 Replies

ActionScript 2.0 :: Multidimensional Length - Get The Length Of Arrays Within An Array

Dec 16, 2004

I am trying to get the length of arrays within an array, here is my example (MX 2004):

[Code]...

I get an output of of 3. the number of variables within the first array, this is not what I had expedted.

View 2 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 :: 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 2.0 :: Read Txt File - Script Dynamic Text Length According To Text Length?

Feb 5, 2010

do anyone know how to script the dynamic text length to the amount of text in the text file instead of manually drag it to the length?

Code:
myLoadVars_lv = new LoadVars();
myLoadVars_lv.onLoad = function(success) {

[code].....

View 0 Replies

Flash :: Sound Length In Actionscript - Get 0 Instead Of The Length In Milliseconds Of The Sound?

Aug 13, 2011

I am trying to use the class Sound of actionscript.My code is really basic :

var snd:Sound = new Sound();
snd.load(new URLRequest("mysound.mp3"));
trace( new String(snd.length));
snd.play();

The audio is playing very well but in my trace, I get 0 instead of the length in milliseconds of the Sound.

View 1 Replies

ActionScript 2.0 :: Stop Further Items Being Dragged Onto A Target When The Target Box Is Full?

Sep 29, 2003

On the attached exercise, is it possible to stop further items being dragged onto a target when the target box is full?

View 1 Replies

Flex4 :: Difference Between Target And Current Target

Nov 28, 2011

What is the difference between target and currenttarget in flex?What is the difference between Target and Current Target in Flex especially in mouse events.

View 2 Replies

ActionScript 3.0 :: Target Movieclip With E.target?

Aug 30, 2010

qi have a movieclip which is added to the stage:

var profileholder:profileHolder=new profileHolder ;

inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:

//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}

this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()

i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}

and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 1 Replies

ActionScript 2.0 :: Error - Target Not Found: Target="whoweare" Base="_level0.instance20.instance48.instance49"

Mar 14, 2005

i don't know why this isn't working.i got a button. and when it's pressed, i need it to go and play a frame in a movie clip. i'll test it and then when i click on it, i get this:

Target not found: Target="whoweare" Base="_level0.instance20.instance48.instance49"

this is the code that i am using:

on (press) {
tellTarget ("whoweare") {
gotoAndPlay (51);
}
}

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

ActionScript 2.0 :: Target Not Found: Target="_root.icon01" Base="_level0"

Feb 16, 2005

so, i'm making an animated rollover, and i get an output error that says this:

Target not found: Target="_root.icon01" Base="_level0"

i have no idea what the base="_level0" means.

View 1 Replies

Limit On An FLV's Length?

Sep 3, 2009

I have an 11 minute video (.MOV) that I want to convert to an FLV. The file is about 29GB.  I first tried to convert it using the CS3 Video Encoder but only the first 5:00 were converted. I tried this a few times with different settings but got the same results. Then I switched to Cleaner but again, only about 5:00 was converted. The length is not exactly the same but close enough for me to think that there might be a 5:00 limit to how long an FLV can be. Or is there a limit to the size of MOV the encoding process will handle?

View 1 Replies

ActionScript 3.0 :: XML Length & For-each?

Sep 24, 2009

I have 10 dynamic text fields inside a movieclip, which are populated via an XML file.However, the xml file sometimes has less than 10 items. It never has more than 10. This results in the following error, which is normal. I need the code to count the amount of items in the XML file and then create a for-each loop. I can visualize it, but I don't know how to write it.Basically what I need the code below transformed in to is this... (notice the #'s)

ActionScript Code:
(count xml items)
fr each item {

[code]......

View 3 Replies

CS3 Difference In Character Length?

May 4, 2009

Each line in the dynamic textbox has 15 characters, and yet you can notice the difference in the length(between each line).

I want to make the length of each line look same if they have same number of charaters.

View 6 Replies

ActionScript 3.0 :: Max Length Is For A String?

Jun 19, 2011

I am trying to find out what the max length is for a string because since as3 doesnt provide any methods for removing characters from a string by changing the initial string itself, i am going to have to stick to re-initializing.I did a little test to see how long it would take for my program to break using the following code:

Actionscript Code:

+[code]..............

The program crashed at a string length of about 500 million.

EDIT:however before it crashed,it performed the incrementations with reasonable performance.

EDIT EDIT: which is strange since my ram still had over 2 gig the program didnt use

View 4 Replies

ActionScript 3.0 :: Getting Length Of Date?

Mar 1, 2012

I am getting an error when I am trying to find the length of the day.My source xml is using single digit day / month and dropping padding 0 however the url string I am trying to build uses padded 0 in their universal paramaters so I am needing to add the 0 when length <= 1doing somthing like this for the month...Actionscript Code:if (urlMonth.length <= 2){urlMonth = "0"+urlMonth}when I try to use this my day however I get Property length not found on Number and there is no default value.

View 1 Replies

ActionScript 1/2 :: Streaming Mp3 Length / How To Get It

May 19, 2009

I am using as2 to stream some mp3s. At the moment I have an attribute within the xml for giving me the length.I guess the length for the mp3s is buried in the mmp3 file somewhere. If I load the files in totally first, then I can get at the info (ID3 is it?) however, this doesn't work for streaming them . Or rather, I can't make it work! (I have found posts which suggest making an estimate if you know how much has downloaded in so many seconds and you know the length etc etc - but this is exactly that - an estimate!)So my question is how do I get the length of an mp3 clip that I am going to stream?

View 1 Replies







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