PDA

View Full Version : Text in a scrolling text box


kaitco
07-30-2007, 03:55 AM
I have what is basically a flash photo album that I have expanded a bit to include scrolling text so a story can be told. What I have found, however, is that if I scroll to the bottom of the text and click 'Next,' the text on the next "page" appears as if the user has scrolled all three lines down first.

This (http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) is the tutorial is used to create the album, but I do not remember how I came about creating the scrolling buttons, which, I admit, might be what is causing the problem.

The files I am using are all in this directory (http://www.doriennesmith.com/working/sim/). 1.jpg shows the problem and 2.jpg shows what should happen after a user clicks 'Next' after scrolling to the bottom of the previous 'page.' images2.xml is the XML file the swf uses, lilithstory.html is the page that uses the swf, photogal.fla is the fla file I have been using and simstory.swf is the swf file, if that is necessary.

Any help on this would be appreciated. Many thanks!

StupidRalph
07-30-2007, 05:03 AM
You should post the actionscript code so we won't have to download and then open (after our Flash application loads) the .fla. Sounds like you are simply iterating through the XML nodes with each button click. All you have to do in your button next button is reset the position of the scrolling text. Post the code if you need further help.

_Aerospace_Eng_
07-30-2007, 05:08 AM
I couldn't find a reset scroll in Flash but one solution would be to create a global variable called count that is initialized to 0.
var count:Number = 0;
That goes at the very top of your actionscript. Then your next button and previous button onrelease AS would look like this
previous_btn.onRelease = function() {

prevImage();
desc_txt.scroll -= count;
};
next_btn.onRelease = function() {

nextImage();
desc_txt.scroll -= count;
};
Then in the actionscript for the down button.
on (release) {
desc_txt.scroll += 1;
count++;
}
and the actionscript for the up button
on (release) {
desc_txt.scroll -= 1;
if(count > 1)
{
count--;
}
}
We don't want it going past 1 hence the if statement.

We also have to take into account the user scrolling with their scroll wheel on their mouse. To take care of this we can set count to desc_txt.scroll by using the onScroller event handler.
desc_txt.onScroller = function()
{
count = desc_txt.scroll;
}
That would go in the main actionscript.

kaitco
07-30-2007, 05:54 AM
Excellent! It works fine now. Thanks a bunch!