TwelvestoneFlash

Blinking on loop - how to prevent?


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
arigato
 
2011-12-05

Hey folks, working with an ooooooold AS2 file that now inexplicably blinks when it loops. It didn't used to and I'm not sure what I broke.

Here's the breakdown - I call external jpg assets into the swf via external txt files. It works fine but blinks as it loops from the last frame to the first.

www.greynotgrey.com/ian/12stone/tmp/loop.zip

wingworm
 
2011-12-05

Bagh, it wont open on my laptop.

Have you tried putting an action on the frame before the last one, sending it back to 1? If that doesnt work put the action on the last frame and send it back to 2.

arigato
 
2011-12-05

Neither of those seems to work.

I resaved the fla as cs4 -

www.greynotgrey.com/ian/12stone/tmp/NARStoreBanner_en.zip

I think it may be because I'm loading the files externally but I've done this before without blinking issues so I'm somewhat stymied.

lithium
 
2011-12-05

Here

Haven't written AS2 in years, so it might be a bit sloppy.

This approach removes the reliance on the timeline, which in my experience, when mixed with actionscript becomes a nightmare.

Also, you can provide a flashvar called "lang" when you embed your swf, and that will choose which files to load for the images and urls.

A.

edit

This uses the same files you originally provided in the zip, so just run the fla from the same location as NARStoreBanner_en.fla and you should be gold.

arigato
 
2011-12-05

OOH pretty...

I'll dig into it further on the morrow.

arigato
 
2011-12-06

Well, that did fix the blink but none of the link actions seem to be working, i.e.; I click on the swf and nothing loads. The flash code looks like it should work (in principle)

FWIW here's the code so others can see what's going on and perhaps recognize the issue...

import mx.utils.Delegate;

var language : String  = _level0.lang || "fr";
var urlPath : String = "url_" + language + ".txt";
var imagePath : String = "images_" + language + ".txt";
var urls : Array = [];
var images : Array = [];

var currentLoader : MovieClipLoader;
var oldLoader : MovieClipLoader;
var holder : MovieClip = createEmptyMovieClip("holder", 0);

var index : Number = 0;

var urlLoader : LoadVars = new LoadVars();
    urlLoader.onLoad = Delegate.create(this, onUrlsLoaded);
    urlLoader.load ( urlPath );

var imageLoader : LoadVars = new LoadVars();
    imageLoader.onLoad = Delegate.create(this, onImagesLoaded);

var switcherID : Number;

launchBtn.onPress = Delegate.create(this, onLaunchPressed);

function onLaunchPressed ( )
{
    var currentURL : String = urls [ index ];
    trace ( "Launching " + currentURL );
    // getURL( currentURL );
}

function onUrlsLoaded ( success )
{
    urls = [ urlLoader.url1, urlLoader.url2, urlLoader.url2 ];
    imageLoader.load ( imagePath );

}

function onImagesLoaded ( success )
{
    images = [ imageLoader.hero1, imageLoader.hero2, imageLoader.hero3 ];
    loadImageAt(0);

    startTimer();
}

function loadNext()
{
    index++;
    if ( index >= images.length ) index = 0;
    loadImageAt(index);
}

function startTimer()
{
    switcherID = setInterval(loadNext, 5000);
}

function loadImageAt( index )
{
    this.index = index;

    if ( currentLoader ) oldLoader = currentLoader;

    var child : MovieClip = spawnChild();

    currentLoader = new MovieClipLoader();
    currentLoader.addListener ( this );
    currentLoader.loadClip ( images[index], child );

}

function spawnChild() : MovieClip
{
    var clip : MovieClip = holder.createEmptyMovieClip("image_" + holder.getNextHighestDepth(), holder.getNextHighestDepth() );
    trace ( ">> " + clip );
    return clip;
}


function onLoadComplete ( clip )
{
    trace ( clip + ' loaded' );
    if ( oldLoader ) 
    {
        oldLoader.unloadClip()
    }
}

function onLoadError ( clip )
{
    trace ( "error" );
}


lithium
 
2011-12-06

Just uncomment the getURL() call inside onLaunchPressed() and you should be golden. It just traces the link at the moment

arigato
 
2011-12-06

You, sir, are a gentleman and a scholar.

lithium
 
2011-12-06

k

One more thing, you're probably going to get the same URL for the last two images, because I'm using url2 from the data file twice. Just change that last url2 to url3 inside onUrlsLoaded()

arigato
 
2011-12-07

Yeah, I fixed that k

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

Blinking on loop - how to prevent?