A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: To Push or Pull in Flash?

  1. #1

    To Push or Pull in Flash?

    Now that I have my news headline crawler working (see my previous post about Horizontal News Scrolling Ticker), I need to find a way to insure that the headlines refresh after the end of each completed crawl.

    Currently, once the ticker MC reaches the end of the crawl, I return it to the starting point just after making a new call to the database for the next set of headlines. Here's the relevant code:

    ----------------------------------
    onClipEvent(enterFrame) {

    if(_root.ticker._x>-winLen){
    _root.ticker._x-= 5; // set speed of crawl by increasing or decreasing this number

    }

    else {

    loadVariables('http://00.00.00.00/objects/flash_headlines.cfm',_parent.MCstage,'GET');

    _root.ticker._x=550; // return headline crawl to starting point to repeat.

    }
    }
    ------------------------------------

    While this approach works great in the Test Movie phase, it does not work in the browser. The initial set of headlines continue to repeat and only by manually refreshing the page do I get a new set.

    What I am wondering is this, what would be the best approach for refreshing the headlines in the browser? I've not experimented with duplicateMovie(), but I am wondering if I need to have something that essentially works like a GOTO statement in Basic that returns the actionscript back to the top of the code block (see complete code below)so that the browser has time to grab the data and play the movie over again. I'd like to keep the entire movie to 1 frame, if possible.

    Also, is there a way in Flash 5 and ColdFusion 5 to "push" content to the movie?

    Any thoughts or suggestions appreciated.


    bill

    -----------------------------------------

    onClipEvent(load){

    loadVariables('http://00.00.00.00/objects/flash_headlines.cfm',_parent.MCstage,'GET');

    _root.attachMovie('dataloader','loading',0);

    _root.loading._x=0;
    _root.loading._y=0;

    stop()
    }

    onClipEvent(data) {


    removeMovieClip(_root.loading);


    //trace('MCstage_COUNT=' + count);
    //trace('MCstage_TICKER=' + ticker_output);

    _root.attachMovie('tickerMovie','ticker',1);

    _root.ticker._x=550;
    _root.ticker._y=0;

    winLen = (count)*5.60
    _root.ticker._width=winLen;
    _root.ticker.ticker_output=ticker_output;
    _root.ticker.count=count;

    trace('WinLen: ' + winLen);

    }

    onClipEvent(enterFrame) {

    if(_root.ticker._x>-winLen){
    _root.ticker._x-= 5; // set speed of crawl by increasing or decreasing this number

    }

    else {

    loadVariables('http://00.00.00.00/objects/flash_headlines.cfm',_parent.MCstage,'GET');

    _root.ticker._x=550; // return headline crawl to starting point to repeat.

    }
    }

  2. #2
    Junior Member
    Join Date
    Jun 2003
    Location
    Toronto
    Posts
    13
    ok, I skimmed through the code and you probably put this all in one keyframe right? try making 2 keyframes with the 2nd keyframe saying something like if(statement that your at the end of ticker) {
    _global.tickercount = 0; //reset counter
    gotoAndPlay(1);
    }
    "Flash is a medium, a very good, very abused medium"

    Jason
    http://www.eclipsestudios.net

  3. #3

    Refreshing Headlines

    Thanks for the suggestion. Actually that was the solution I finally settled on, although not exactly how you indicated. I simply say in the else statement to _root.gotoAndPlay(2) and in frame 2 I say gotoAndPlay(1). I've been watching it refresh the last hour or so and it seems to work just fine. I've had to tweak the winLen multipler from 5.6 to 5.75. This changes the width of the textField to match the continually changing length of the 10 headlines I pull at each pass.

    Bill

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