I have a text box set to Input Text and a button on my stage in Flash CS4 professional. I would like to type an integer value in the input text box, click the button, and have the value of the text box pass into a function. The way I have it working now is by placing a value into the text box, hitting the button which has the following actions attached to it:
on(release){
gotoAndStop(2);
}
Then on frame two the following code:
init(nodes.text);
function init(a) {
for (var i:Number = 0; i<a; i++) {
//This loop will execute the code contained in it 10 times
this.attachMovie("blueCircle", "blue"+i, this.getNextHighestDepth());
//Here we are retrieving the mc from the library, giving it a name 'blue'+i, and setting it at the next highest depth.
//blueCircle is the linkage identifier given when it was converted to symbol.
var mc:MovieClip = this["blue"+i];
mc._x = Math.round(Math.random()*800);
mc._y = Math.round(Math.random()*800);
//above three lines: The this[...]method allows you to create a reference to an object containing the name you pass it.
//in our case 'blue'+i. This is stored in the variable 'mc'.
//Now that we have a reference to the movie clip, we can assign various properties to it.
//We first alter the x and y positions of the mc.
mc.onPress = function() {
this.startDrag();
};
mc.onRelease = function() {
this.stopDrag();
};
}
There must be an easier way than this though. I have tried a handful of things, but no luck yet. Any assistance will be greatly appreciated. Thank you!

New Topic/Question
Reply



MultiQuote





|