Forum Moderators: open

Message Too Old, No Replies

Flash crashes.

crash link html

         

Mrricky

7:00 pm on Feb 21, 2006 (gmt 0)



Hello,

I have developed this dynamic text scroller that loads the text from an external file.

Now the problem is that the browser or the flash itself either crash or have no effect when an Hyperlink is clicked on.

here is the code:
######################################################
frame 1:

var css_url = "http://example.com/css/noticias.css";
var content_url = "eventos.txt";

var style_sheet = new TextField.StyleSheet();

loadVariablesNum("eventos.txt", 0);

this.createTextField("noticiasTexto", 997, 43, 90, 70, 30);
noticiasTexto.multiline = true;
noticiasTexto.autoSize = true;
noticiasTexto.wordWrap = true;
noticiasTexto.variable = "content";

style_sheet.load(css_url);
noticiasTexto.styleSheet = style_sheet;
######################################################

frame 2:
/************************************************************************

position - The actual text position

size - the size of the textArea

lastLine - The last visible text line

************************************************************************/
position = noticiasTexto._y;
size = noticiasTexto._height;
lastLine = position + size;

if(!cont)
cont = setInterval(contScroll, 50);

/************************************************************************

Off and On states for the Up button

************************************************************************/
function upOff() {
Up.enabled = false;
Up._alpha = 30;
}
function upOn() {
Up.enabled = true;
Up._alpha = 100;
}

/************************************************************************

Off and On states for the Down button

************************************************************************/
function downOff(){
Down._alpha = 30;
Down.enabled = false;
}
function downOn(){
Down._alpha = 100;
Down.enabled = true;
}

/************************************************************************

Moves the text up unless it is on the
first line.

else it disables the button and clears
both timers the fast and normal paced one

************************************************************************/
function scrollUp() {
// Can it move up?
if (position < 15) {
if (cont)
clearInterval(cont);
downOn();
noticiasTexto._y += 1;
} else {
upOff();
clearInterval(up);
clearInterval(upFast);
}
}

/************************************************************************

Moves the text down unless it is on the
last line 50 is an aproximation of the
displayable window size.

else it disables the button and clears
both timers the fast and normal paced one

************************************************************************/
function scrollDown() {
// Can it move down?
if (lastLine > 60) {
if (cont)
clearInterval(cont);
upOn();
noticiasTexto._y -= 1;
} else {
downOff();
clearInterval(down);
clearInterval(downFast);
}
}

/************************************************************************

Makes the text return to its original position

************************************************************************/
function moveToTop(){
clearInterval(cont);
clearInterval(delay);
noticiasTexto._y = 15;
upOn();
downOn();
cont = setInterval(contScroll, 50);
}

/************************************************************************

Recursive call to perform a continuous scroll

Activated on runtime after text is loaded

************************************************************************/
function contScroll() {

upOn();

//clearInterval(cont);

//cont = setInterval(contScroll, 50);

// If at max scroll position
if (lastLine <= 60){
clearInterval(cont); // Stops the movement
clearInterval(delay); // makes sure there is no pause in progress
delay = setInterval (moveToTop, 1500); // starts the pausing
}else{
noticiasTexto._y -= 1;
}
}

######################################################

frame 3:
gotoAndPlay("two");

[edited by: BlobFisk at 1:22 pm (utc) on Feb. 22, 2006]
[edit reason] Examplified URL [/edit]