-
String into code
Hi,
I'm trying to create a series of scripts that will create some custom event listeners.
I have three movie clips on my stage. One is a movieclip who's sole function is to hold array's and the event listeners. A second which moves around the screen. And a third that is motionless.
The problem is that the argument I want to test (which activates the custom event) is held within a string.
What I want to know is, how do you test to see if the string argument is true?
Is it something similar to this:
Code:
var myCode:String="1<0";
if(myCode){
trace('one is smaller than 0'); //Strangely apparently one IS smaller than 0!!!
}
I think I'm going about this in the wrong manner, however this is the only way I can think of this working... (since I need to be able to dynamically create these events)
Thanks for any help,
Pokenerd
-
Flactionscrish
When you try to evaluate a string there are only two possibilities.
An empty string equates to false
a string with anything in it equates to true
this method you are trying to use will not work.
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
-
Well...
I was hoping to do something with square brackets, but it turns out those are only for objects, and references and what not...
I think that d.eval might work however.
-
research string slice and implode. check out the AS3 reference online for that. you may get pretty excited.
p.s: i don't really know if AS3 has string.implode but check.
-
No, there's no implode method on String, but there is a join method on Array which does the same thing. It makes a lot more sense for the method to be on Array than String anyway.
-
Bearded (M|G)od
Originally Posted by 5TonsOfFlax
No, there's no implode method on String, but there is a join method on Array which does the same thing. It makes a lot more sense for the method to be on Array than String anyway.
Python uses join as a method of a string. Like: ",".join(mylist)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|