EN LA LINEA DE CODIGO NUMERO 10 QUE PONE:estilo.font="Budmo Jiggler";QUE ES LA FUENTE QUE ME ESCRIBE EN UN TEXTO...
ME GUSTARIA ME COGIERA LA FUENTE DE UN COMBOBOX.NO HAY MANERA¡¡¡¡¡
ME PODRIAN DECIR COMO TENGO QUE ARREGLARLO PARA QUE SI ME COJA UNA DE LAS OPCIONES DEL COMBOBOX,,,MAS ABAJO LES DEJARE EL CODIGO DEL COMBOBOX.
MUCHAS GRACIAS
Código :
/****************************************************** cp es un array de 4 elementos, donde: cp[0] es el punto inicial. cp[1] es el punto de anclaje del punto inicial. cp[2] es el punto de anclaje del punto final. cp[3] es el punto final. t es el valor del parámetro, 0 <= t <= 1 *******************************************************/ //Creamos un estilo para los textos estilo = new TextFormat(); estilo.font="Budmo Jiggler"; estilo.size = 30; estilo.color = 0xffffff; // //Creamos las líneas de los puntos de ancla _root.createEmptyMovieClip("linIni", 33333); //Ponemos la curva inicial var cp:Array = new Array(p0, p1, p2, p3); n = 0; numberOfPoints = 100; t = 0; dt = 1/(numberOfPoints-1); //Creamos la curva for (i=0; i<numberOfPoints; i++){ t += dt; pointOnCubicBezier(cp, t); } //Si hemos puesto un texto lo añadimos a la curva if (texto_txt.text != ""){ ponerTexto(); } //Eventos for (i=0; i<4; i++){ _root["p"+i].onPress = function(){ startDrag(this, true); pulsado = true; } _root["p"+i].onRelease = function(){ stopDrag(); pulsado = false; } } function pointOnCubicBezier(cp, t){ // Calcular los coeficientes polinomiales (o algo así) cx = 3 * (cp[1]._x - cp[0]._x); bx = 3 * (cp[2]._x - cp[1]._x) - cx; ax = cp[3]._x - cp[0]._x - cx - bx; cy = 3 * (cp[1]._y - cp[0]._y); by = 3 * (cp[2]._y - cp[1]._y) - cy; ay = cp[3]._y - cp[0]._y - cy - by; // Calcular el punto de curva para el parámetro con valor t tSquared = t * t; tCubed = tSquared * t; attachMovie("puntos", "puntos"+n, n); _root["puntos"+n]._x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0]._x; _root["puntos"+n]._y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0]._y; n++; } function ponerTexto(){ var letra_str:String = new String(); var letras:Array = new Array(); letra_str = texto_txt.text; largo = texto_txt.length; //Numero de puntos de separación entre letra y letra posicion = Math.round(numberOfPoints/largo); //Array con las letras letras = letra_str.split(""); for (i=0; i<largo; i++){ _root.createTextField("letra"+i, 9999+i, _root["puntos"+(posicion*i)]._x , _root["puntos"+(posicion*i)]._y - 60,116,116,116); _root["letra"+i].embedFonts = true; _root["letra"+i].selectable = false; _root["letra"+i].text = letras[i]; _root["letra"+i].setTextFormat(estilo); } } //Añadimos el texto a la curva addTexto_btn.onPress = function(){ //Si hemos puesto un texto lo añadimos a la curva if (texto_txt.text != ""){ ponerTexto(); } } //Cuando movemos el ratón actualizamos la línea alMover = new Object(); alMover.onMouseMove = function(){ if (pulsado == true){ //Declaramos variables var cp:Array = new Array(p0, p1, p2, p3); n = 0; numberOfPoints = 200; t = 0; dt = 1/(numberOfPoints-1); //Creamos la curva for (i=0; i<numberOfPoints; i++){ t += dt; pointOnCubicBezier(cp, t); } //Si hemos puesto un texto lo añadimos a la curva if (texto_txt.text != ""){ ponerTexto(); } } } Mouse.addListener(alMover);
CODIGO DEL COMBOBOX
Código :
var myFonts:Array = TextField.getFontList(); myFonts.sort(); combo3.dataProvider = myFonts; var comboListener:Object = new Object(); combo3.addEventListener("change", comboListener); comboListener.change = function(evt:Object) { var estilo:TextFormat = new TextFormat(); estilo.font = String(evt.target.selectedItem); texto_txt.setTextFormat(estilo); };
EL COMBOBOX,SI ME CAMBIBA LA FUENTE DEL TEXTO,PERO NO LA PASA AL :_root.createEmptyMovieClip("linIni", 33333);
