1085 posts
  • Trendsetter
  • Weekly Top Seller
  • Top Monthly Author
  • Elite Author
+12 more
damojo
says

Hi,

I want users to be able to select the easing type of a tween via xml. For example “Regular.easeOut”. How can I parse the string to a regular expression so it can be recognised by flash?

Thanks :)

344 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
  • Exclusive Author
+3 more
flashblue
says

eval(“Regular.easeOut”)

1085 posts
  • Trendsetter
  • Weekly Top Seller
  • Top Monthly Author
  • Elite Author
+12 more
damojo
says

gives me an undefined…

344 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
  • Exclusive Author
+3 more
flashblue
says

I tried it. It works. Use eval(“text” )

1085 posts
  • Trendsetter
  • Weekly Top Seller
  • Top Monthly Author
  • Elite Author
+12 more
damojo
says

var easing = eval(XMLdaten_easing[p]);
trace(easing);

= undefined!

:(

344 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
  • Exclusive Author
+3 more
flashblue
says

var easing = XMLdaten_easing[p]; easing = eval(easing );

344 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
  • Exclusive Author
+3 more
flashblue
says

Use the code above. You wrote it before giving text value.

1085 posts
  • Trendsetter
  • Weekly Top Seller
  • Top Monthly Author
  • Elite Author
+12 more
damojo
says

Did exactly as you said… Still not working.

var easing = XMLdaten_easing[p];
easing = eval(easing);
trace(easing);

279 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 1
+5 more
FonZ
says

Have you tried making it a var first and then eval?

var easing = XMLdaten_easing[p];

myEase = eval(easing);

????

You could write an else if statement to construct what you need.

var easing = XMLdaten_easing[p];

Split it at the dot

mySplit = easing.split(”.”);

then check the first part of the mySplit

if(mySplit0==”Regular”){

construct what you need

} else etc

Then check the second. Bit more work involved and my coding could be off, but it’s an option.

Regards, FonZ

344 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Collector Level 1
  • Exclusive Author
+3 more
flashblue
says

Trace parameter can’t be not understand it. Because, your text changes to Easing object. Try it on the tween method. It works so.

by
by
by
by
by
by