dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: How do I incorporate text in a scrolling text box in a stand alone player

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    165
    Does anyone know how too incorporate srolling text into a stand alone movie? The text shows up when I have it in an html page, but how do I get it to come up when in just the stand alone player?

    Mike

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    How did you refrence your text file when the SWF was on the net?

    If you had a relative refrence EG: you are trefrencing it as text.txt instead of an absoulute http://www.mydomain/mydir/text.txt and you did not save the text.txt in the same directory (Folder) as your projector then it won't work.

    Anyhow one way or another your problem is that you aren't refrencing the text file properly.


  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Your URI has to be wrong if it works in a SWF but doesnot work in a projector.

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    165
    I have the text_profile.txt file in the same folder as the SWF file.. and the text shows up in an HTML page, but in just the SWF file it shows up as...

    <P ALIGN="LEFT"></>

    ?

    here's the Action script that pulls it in..


    onClipEvent (load){

    this.loadVariables("text_profile.txt");
    scrolling = 0;
    frameCounter = 1;
    speedFactor = 3;
    numLines = 7;

    origHeight = scrollbar._height;
    origX = scrollbar._x;
    needInit = false;

    function initScrollbar(){

    var totalLines = numLines + daTextBox.maxscroll - 1;
    scrollbar._yscale = 100*(numLines)/totalLines;
    deltaHeight = origHeight - scrollbar._height;
    lineHeight = deltaHeight/(daTextBox.maxScroll - 1);
    }
    function updateScrollBarPos(){

    scrollbar._y = lineHeight*(daTextBox.scroll - 1);
    }
    }

    onClipEvent (enterFrame){

    if( needInit ){
    if(daTextBox.maxscroll > 1){
    initScrollbar();
    needInit = false;
    }
    }
    if( frameCounter % speedFactor == 0){

    if( scrolling == "up" && daTextBox.scroll > 1){
    daTextBox.scroll--;
    updateScrollBarPos();
    }
    else if( scrolling == "down" && daTextBox.scroll < daTextBox.maxscroll){
    daTextBox.scroll++;
    updateScrollBarPos();
    }
    frameCounter = 0;
    }
    frameCounter++;
    }

    onClipEvent (mouseDown){

    if(up.hitTest(_root._xmouse,_root._ymouse)){
    scrolling = "up";
    frameCounter = speedFactor;
    up.gotoAndStop(2);
    }
    if(down.hitTest(_root._xmouse,_root._ymouse)){
    scrolling = "down";
    frameCounter = speedFactor;
    down.gotoAndStop(2);
    }
    if(scrollbar.hitTest(_root._xmouse,_root._ymouse)) {
    scrollbar.startDrag(0,origX,deltaHeight,origX);
    scrolling = "scrollbar";
    }
    updateAfterEvent();
    }

    onClipEvent (mouseUp){

    scrolling = 0;
    up.gotoAndStop(1);
    down.gotoAndStop(1);
    stopDrag();

    updateAfterEvent();
    }

    onClipEvent (mouseMove){
    if(scrolling == "scrollbar"){
    daTextBox.scroll = Math.round((scrollbar._y)/lineHeight + 1);
    }
    updateAfterEvent();
    }

    onClipEvent (data){
    needInit = true;
    }

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Check your text file, your script looks right:
    (also check to see if your Box is set to handle HTML)

    This is a clue that your dynamic text has been switched:

    <P ALIGN="LEFT"></>


    This part of your script is what loads the text:

    this.loadVariables("text_profile.txt");


    Ahhh... I also see that you have it set to Load the text trigered from a clip event.
    Try just using loadVariables("text_profile.txt"); attached to a frame early on in the movie. Crete a variable at the end of your txtfile and set your preloader to loop until that value has changed to the new value.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center