TwelvestoneFlash

need to modify function to place thumbnails in random order


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 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 ...
unata
 
2008-11-08

I have this vertical scroller script that I got from Flashden.net

vertical scroller

Unfortunately, I can't even figure out where to start to modify it so it displays the thumbnails in random order. I think this is the function

private function generate() {
    Thumbs = remove(Thumbs);
    Thumbs = create();
    Thumbs.setMask(Mask);
    toFront(TF);
    toFront(BF);
    var mc:MovieClip;
    items = 0;
    spos = -1;
    tsh = 0;
    var n:XMLNode = node.firstChild;
    for (; n != null; n=n.nextSibling) {
        mc = Thumbs.attachMovie("IDThumbnail", "THUMB"+items, Thumbs.getNextHighestDepth());
        var lbh:Number = mc.LHeight;
        tm = lbh;
        mc.height = th;
        mc.width = w;
        mc.setData(n, hand);
        mc._y = items*(th+tm+ts);
        mc._x = 0;
        if (n.attributes.selected != undefined) {
            spos = items;
        }
        tsh += th+ts+tm;  
        items++;
    }
    tsh -= ts;
    Thumbs._y = -tsh;
}

Can anyone make any sense out of this?

JLM
 
2008-11-09

yuk I would rewrite from scratch, that is horrible to read code, unmaintainable.

if you create an array of possible item positions before current loop

var count:Number = 0; var arrayPositions:Array=[]; for ( n= node.firstChild; n != null; n=n.nextSibling) { arrayPositions[count]=count++; }

then later randomly extract item positions, so change current y setting to something like

//untested mc._y = arrayOfPositions.splice(Math.round(Math.random()arrayOfPositions.length),1)(th+tm+ts);

but test the code out of the current system before trying inside.

unata
 
2008-11-10

I know, this is pretty bad for a commercially sold script (even one that is sold for 10$). The support forum consists of people selling breast enhancements and the script author coming on every month or so to tell people "the scroller has certain limitations" to inquiries with "too many thumbnails" and "thumbnails are too large".

I'll have to check the support forum next time before spending ten bucks I guess.

Thank you for your help, JLM, I'll try that.

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

need to modify function to place thumbnails in random order