03/07/2008, 11:29
|
| | Fecha de Ingreso: julio-2008
Mensajes: 2
Antigüedad: 16 años, 4 meses Puntos: 0 | |
Ayudita con un problemilla de ActionScript Buenas!
Primero que todo decir, que hace unos pocos meses que me he inicidado en esta aventura del flash, y que este foro me ha sido de bastante utilidad, es por eso que comento mi problemilla aquí, a ver si alguien pudiera ayudarme, comento.
Estoy elaborando un sitio web para una empresa, y en una sección quería añadir un frame de texto, editable a través del web, introduciendo un usuario y una contraseña, como si se tratase de un CMS, algo parecido.
Mi problema no está con la parte de acceder con usuario y modificar, eso es fácil, mi problema está en que encontré la parte del frame, lo he adaptado a mi sitio web y tal, pero, el texto, realiza el efecto siguiente:
Aparece desde abajo se coloca en el frame de texto, y unos segundos después, éste se desliza hacia arriba desapareciendo. Este proceso se reitera indefinidamente, y me gustaría saber que es lo que hace en este script de ActionScript que el texto realize este efecto, que lo aplica a textos dinámicos:
#initclip
// initialize the NewsTickerClass----------->
NewsTickerClass = function () {
this.init();
};
// register the Object-Class with the Movieclip------------->
Object.registerClass("hlnewsticker", NewsTickerClass);
// define INITialisation-function------------------->
NewsTickerClass.prototype.init = function() {
// get rid of the cross that helped positioning --->
this.crossMC._visible = false;
// setting up a counter ---------------------------------->
this.count = 0;
// dynamic Textfield-Properties ------------------------>
this.myTextTarget = this._parent[this._targetInstanceName];
this.outerxPos1 = (this.aniRangeX/2)+(this.myTextTarget._x+this.myTextTarget._width) ;
this.outerxPos2 = (this.aniRangeX/2)-(this.myTextTarget._x+this.myTextTarget._width);
this.outeryPos1 = (this.aniRangeY/2)+(this.myTextTarget._y+this.myTextTarget._height );
this.outeryPos2 = (-this.aniRangeY/2)-(this.myTextTarget._y-this.myTextTarget._height);
this.centerYpos = this.myTextTarget._y;
this.centerXpos = this.myTextTarget._x;
this.animType = 0;
//check the types of animation for the 'ifs' in the function theMoveOut -->
if (this.xAnim == true) {
this.animType += 1;
}
if (this.yAnim == true) {
this.animType += 2;
}
// Animation-Properties -------------------------------->
this.brakespeed = 5;
this.myTime = 0;
this.beginLoad();
};
// function to load the textfile and check if loaded ----->
///////////////////// CUSTOMIZATION STARTS ////////////////////////////////
// Declaring a variable as unique identifier.
time=new Date().getTime();
/*
If you have php support and want to prevent chaching just change the file url to yours one
Note that if you change the file paramater in component option it will not work. because to tweaking.
You have to change it here. */
NewsTickerClass.prototype.beginLoad = function() {
loadVariables( "reader.php?now="+time, this);
///////////////////// CUSTOMIZATION ENDS ////////////////////////////////
this.onData = function() {
if (this.news != "") {
this.splitArray();
delete this.onData;
}
};
};
// function to split the Textfile into an Array ----->
NewsTickerClass.prototype.splitArray = function() {
//create an array that will hold the single texlines.---->
this.myArray = new Array();
//splits the text sepparated by "," -->
this.myArray = this.news.split("|");
this.setTextfield();
};
// function to set the Textfield and ----->
NewsTickerClass.prototype.setTextfield = function() {
if (this.myTextTarget.html == true){
this.myTextTarget.htmlText = this.myArray[this.count];
}else{
this.myTextTarget.text = this.myArray[this.count];
}
if (this.yAnim == true) {
this.myTextTarget._y = this.outeryPos1;
}
if (this.xAnim == true) {
this.myTextTarget._x = this.outerxPos1;
}
// reset accelspeed -->
this.accelspeed = 0;
this.theMoveIn();
};
// function for the Move-In Animation ----->
NewsTickerClass.prototype.theMoveIn = function() {
this.onEnterFrame = function() {
if (this.yAnim == true && this.centerYpos<this.myTextTarget._y) {
this.myTextTarget._y += ((this.centerYpos-this.myTextTarget._y)/this.brakespeed)/this.brake;
}
if (this.xAnim == true && this.centerXpos<this.myTextTarget._x) {
this.myTextTarget._x += ((this.centerXpos-this.myTextTarget._x)/this.brakespeed)/this.brake;
updateAfterEvent();
}
if (this.centerYpos>=this.myTextTarget._y-0.5 && this.centerXpos>=this.myTextTarget._x-0.5) {
delete this.onEnterFrame;
this.theStopInterval();
}
};
};
// function that lets the Text stand still for the amount of Time in seconds,
// that a user defined in "stopTime" ----->
NewsTickerClass.prototype.theStopInterval = function() {
delete this.onEnterFrame;
this.intervalHandle = setInterval(this, "onInterval", 1000*this.stopTime);
};
NewsTickerClass.prototype.onInterval = function() {
clearInterval(this.intervalHandle);
this.theMoveOut();
};
// function for the Move-Out Animation ----->
NewsTickerClass.prototype.theMoveOut = function() {
this.onEnterFrame = function() {
this.accelspeed += this.acceleration;
if (this.xAnim == true) {
this.myTextTarget._x -= this.accelspeed;
}
if (this.yAnim == true) {
this.myTextTarget._y -= this.accelspeed;
}
switch (this.animType) {
case 1 :
if (this.outerxPos2>this.myTextTarget._x) {
this.count++;
if (this.count>=this.myArray.length) {
this.count = 0;
}
delete this.onEnterFrame;
// call the setTextfield function again
// this is where the whole thing starts looping
this.setTextfield();
}
break;
case 2 :
if (this.outeryPos2>this.myTextTarget._y) {
this.count++;
if (this.count>=this.myArray.length) {
this.count = 0;
}
delete this.onEnterFrame;
// call the setTextfield function again
// this is where the whole thing starts looping
this.setTextfield();
}
break;
case 3 :
if (this.outeryPos2>this.myTextTarget._y && this.outerxPos2>this.myTextTarget._x) {
this.count++;
if (this.count>=this.myArray.length) {
this.count = 0;
}
// call the setTextfield function again
// this is where the whole thing starts looping
delete this.onEnterFrame;
this.setTextfield();
}
break;
}
};
};
#endinitclip
Ójala alguien pudiera ayudarme, porque llevo peleándome con este script bastantes horas, y no hay forma, gracias de antemano.
Saludos
djgatiu |