0

How to insert complex strings into Actionscript?

So I have a string

    -vvv -I rc w:// v dv s="60x40" --ut="#scode{vcode=FV1,acode=p3,ab=128,ch=2,rate=4400}:dup{dt=st{ac=http{mime=v/x-flv},mux=mpeg{v},dt=:80/sm.fv}}"

How to insert it into code like

public var SuperPuperComplexString:String = new String();
SuperPuperComplexString =  TO_THAT_COMPLEX_STRING;

That string has so many problems like some cart of it can happen to be like regexp BUTI DO NOT want it to be parsed as any kind of reg exp - I need It AS IT IS!)

How to put that strange string into variable (put it not inputing it thru UI - hardcode it into AS code)?

2 Answers 2

2

SInce the only problem characters in your string are the double quotes ( " " ), just enclose your String in single quotes ( ' ' ). That will solve any problems.

It also depends on how you are loading that string into your code, as well.

You could even go so far as to encase that String in XML CDATA to ensure it's all delimited for when you want to use it.

var myString:XML = new XML();
myString = "<string><![CDATA[-vvv -I rc w:// v dv s="60x40" --ut="#scode{vcode=FV1,acode=p3,ab=128,ch=2,rate=4400}:dup{dt=st{ac=http{mime=v/x-flv},mux=mpeg{v},dt=:80/sm.fv}}"]]></string>"

Then, you can access it as a string from anywhere by just referencing myString.

Sign up to request clarification or add additional context in comments.

Comments

2
var myString:String = '-vvv -I rc w:// v dv s="60x40" --ut="#scode{vcode=FV1,acode=p3,ab=128,ch=2,rate=4400}:dup{dt=st{ac=http{mime=v/x-flv},mux=mpeg{v},dt=:80/sm.fv}}"'

Not sure where your problem is..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.