Hi to everybody,
i'm quite new to action script 3.0, and before posting the question I googled, but with little success. So my question is how to convert a string into a movie clip instance?
I need it in order to handle then that movie clip instance with tween class methods.
So, I've got
var str:String = "a";
var mc:MovieClip = new MovieClip();
and what I want to have as a result is that the movie clip mc contains the letter "a" inside.
Any suggestions are appreciated.
import flash.text.TextField;
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var str:String = "a";
var myText:TextField = new TextField();
myText.text = str;
var myMC:MovieClip = new MovieClip();
myMC.addChild(myText);
addChild(myMC);
var myTween:Tween = new Tween(myMC, "x", Strong.easeOut, 40, 300, 5, true);
OR
import flash.text.TextField;
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var str:String = "a";
var myText:TextField = new TextField();
myText.text = str;
addChild(myText);
var myTween:Tween = new Tween(myText, "x", Strong.easeOut, 40, 300, 5, true);
There is quite a few ways to do this. The above may not be the most efficient or best way. Essentially, the text in your string has to be set as the text property of a text field container, and then the text field container needs to be added to the displaylist. Then it can be tweened.
North America
Europe, Middle East and Africa
Asia Pacific