A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Images in slide show appearing in random order

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    3

    Images in slide show appearing in random order

    Hello, I purchases a ac2 slide show which makes the images appear in random order when browser is refreshed. Is there a solution to this? I've provided the code below also attched the .fla file.Thanks!


    import flash.filters.DropShadowFilter;
    BarHeight=160;
    BarHeightOver=170;
    BarWidth=900;
    Spacing=20;
    alpha=100;
    barColor="0xFFFFFF";
    borderColor="0xFFFFFF";
    borderColorOnOver="0xFFFFFF";
    borderSize=0;
    barBorder=0;
    background=false;
    efect=3;
    WidthSpacing=50;
    var textFormat:TextFormat = new TextFormat();
    textFormat.bold=false;
    textFormat.font="arial";
    textFormat.size=1;
    textFormat.color=0xFFFFFF;

    xml=new XML();
    xml.ignoreWhite=true;
    xml.load("scroll.xml"); // Set the xml file
    xml.onLoad = function(ok)
    {
    if (ok)
    create_scroll();
    }

    openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {

    getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);");
    };

    create_scroll =function(){

    this.createTextField("test",this.getNextHighestDep th(),0,0,0,0);
    test.autoSize="center";
    test.text="home";
    test.setTextFormat(textFormat);
    testHeight=test._height;
    test.text="";

    this.createEmptyMovieClip("scroll",this.getNextHig hestDepth());
    scroll._x=(Stage.width-BarWidth)/2;
    scroll._y=(Stage.height-BarHeightOver)/2;
    scroll.createEmptyMovieClip("barBackground",scroll .getNextHighestDepth());
    with(scroll.barBackground){
    beginFill(barColor,100);
    lineTo(BarWidth,0);
    lineTo(BarWidth,BarHeightOver+(2*barBorder));
    lineTo(0,BarHeightOver+(2*barBorder));
    lineTo(0,0);
    }

    scroll.createEmptyMovieClip("bar",scroll.getNextHi ghestDepth());

    scroll.createEmptyMovieClip("barMask",scroll.getNe xtHighestDepth());
    with(scroll.barMask){
    beginFill(0x000000,100);
    lineTo(BarWidth,0);
    lineTo(BarWidth,BarHeightOver+(2*barBorder)+testHe ight);
    lineTo(0,BarHeightOver+(2*barBorder)+testHeight);
    lineTo(0,0);
    }

    scroll.bar.setMask(scroll.barMask);
    var dsfInstanceLeftropShadowFilter = new DropShadowFilter(0, 0,
    barColor, 0, 0, 0);
    var dsfInstanceRightropShadowFilter = new DropShadowFilter(0, 0,
    barColor, 0, 0, 0);

    scroll.createEmptyMovieClip("blurLeft",scroll.getN extHighestDepth());
    with(scroll.blurLeft){
    beginFill(barColor,100);
    lineTo(20,0);
    lineTo(20,BarHeightOver+(2*barBorder));
    lineTo(0,BarHeightOver+(2*barBorder));
    lineTo(0,0);
    _x=-20;
    filters=[dsfInstanceLeft];
    }
    scroll.createEmptyMovieClip("blurRight",scroll.get NextHighestDepth());
    with(scroll.blurRight){
    beginFill(barColor,100);
    lineTo(20,0);
    lineTo(20,BarHeightOver+(2*barBorder));
    lineTo(0,BarHeightOver+(2*barBorder));
    lineTo(0,0);
    _x=scroll.bar._x+BarWidth;
    filters=[dsfInstanceRight];
    }

    width=WidthSpacing;
    var pic:Object = new Object();
    pic.onLoadInit = function(target:MovieClip){
    target.forceSmoothing = true;
    while (target._height>BarHeight-2*borderSize){
    target._height-=target._height/100;
    target._width-=target._width/100;
    }
    target._x=width+borderSize;
    target._y=borderSize+barBorder+(BarHeightOver-BarHeight)/2;
    target.width=target._width;
    target.height=target._height;
    target.load=true;
    target._alpha=alpha;
    width+=(target._width+Spacing+(2*borderSize));
    for (j=0;j<xml.firstChild.childNodes.length;j++){
    if (target==scroll.bar["picture"+j].pic){
    scroll.bar["picture"+j].y=scroll.bar["picture"+j]._y;
    scroll.bar["picture"+j].x=scroll.bar["picture"+j]._x;
    if (background){
    with(scroll.bar["picture"+j].background){
    beginFill(0x666666,100);
    lineTo(target._width+2*borderSize,0);
    lineTo(target._width+2*borderSize,target._height+2 *borderSize);
    lineTo(0,target._height+2*borderSize);
    lineTo(0,0);
    _x=target._x-borderSize;
    _y=target._y-borderSize;
    }
    }
    scroll.bar["picture"+j].onRollOver = function(){
    this.caption=true;
    }
    scroll.bar["picture"+j].onRollOut = function(){
    this.caption=false;
    scroll.info.text="";
    }
    scroll.bar["picture"+j].onRelease = function(){
    for (k=0;k<xml.firstChild.childNodes.length;k++)
    if (this==scroll.bar["picture"+k]){
    openWinCentre(xml.firstChild.childNodes[k].attributes.address, xml.firstChild.childNodes[k].attributes.target_winName, int(xml.firstChild.childNodes[k].attributes.width), int(xml.firstChild.childNodes[k].attributes.height), int(xml.firstChild.childNodes[k].attributes.toolbar), int(xml.firstChild.childNodes[k].attributes.location), int(xml.firstChild.childNodes[k].attributes.directories), int(xml.firstChild.childNodes[k].attributes.status), int(xml.firstChild.childNodes[k].attributes.menubar), int(xml.firstChild.childNodes[k].attributes.scrollbars), int(xml.firstChild.childNodes[k].attributes.resizable));
    //this.getURL(xml.firstChild.childNodes[k].attributes.link,xml.firstChild.childNodes[k].attributes.target);
    }
    }

    }
    }

    }

    var imag:MovieClipLoader = new MovieClipLoader();
    imag.addListener(pic);
    for (i=0;i<xml.firstChild.childNodes.length;i++){
    scroll.bar.createEmptyMovieClip("picture"+i,i);
    scroll.bar["picture"+i].createEmptyMovieClip("background",scroll.bar["picture"+i].getNextHighestDepth());
    scroll.bar["picture"+i].createEmptyMovieClip("pic",scroll.bar["picture"+i].getNextHighestDepth());
    imag.loadClip(xml.firstChild.childNodes[i].attributes.url,scroll.bar["picture"+i].pic);
    }
    scroll.createTextField("info",scroll.getNextHighes tDepth(),0,BarHeightOver+barBorder*2,0,0);
    scroll.info.autoSize="center";


    scroll.barMask.onEnterFrame=function(){
    for (i=0;i<xml.firstChild.childNodes.length;i++){
    if (scroll.bar["picture"+i].caption){
    scroll.textBar.info.text=xml.firstChild.childNodes[i].attributes.title;
    scroll.textBar.info.setTextFormat(textFormat);
    scroll.bar["picture"+i].pic._alpha=100;
    scroll.info.text=xml.firstChild.childNodes[i].attributes.title;
    scroll.info.setTextFormat(textFormat);
    if (background)
    scroll.info._x=scroll.bar["picture"+i].background._x+scroll.bar._x;
    else
    scroll.info._x=scroll.bar["picture"+i].pic._x+scroll.bar._x+(scroll.bar["picture"+i].pic._width-scroll.info._width)/4;
    var color:Color = new Color(scroll.bar["picture"+i].background);
    color.setRGB(borderColorOnOver);
    if (efect==1)
    scroll.bar["picture"+i]._y=5;
    if (efect==2)
    scroll.bar["picture"+i]._y=-5;
    if ((efect==3)&&(scroll.bar["picture"+i]._height<BarHeightOver)){
    scroll.bar["picture"+i].swapDepths(xml.firstChild.childNodes.length)
    scroll.bar["picture"+i].pic._height+=5*scroll.bar["picture"+i].pic._height/100;
    scroll.bar["picture"+i].pic._width+=5*scroll.bar["picture"+i].pic._width/100;
    scroll.bar["picture"+i]._y-=5*scroll.bar["picture"+i]._height/200;
    scroll.bar["picture"+i]._x-=5*scroll.bar["picture"+i]._width/200;
    scroll.bar["picture"+i].background._width=scroll.bar["picture"+i].pic._width+(2*borderSize);
    scroll.bar["picture"+i].background._height=scroll.bar["picture"+i].pic._height+(2*borderSize);

    }
    }
    else{
    var color:Color = new Color(scroll.bar["picture"+i].background);
    color.setRGB(borderColor);
    scroll.bar["picture"+i].pic._alpha=alpha;
    if ((efect==1)or(efect==2))
    scroll.bar["picture"+i]._y=0;
    if ((efect==3)&&(scroll.bar["picture"+i].background._height>BarHeight)&&(background)){
    scroll.bar["picture"+i].swapDepths(i);
    scroll.bar["picture"+i].pic._height-=5*scroll.bar["picture"+i].pic._height/100;
    scroll.bar["picture"+i].pic._width-=5*scroll.bar["picture"+i].pic._width/100;
    scroll.bar["picture"+i]._x+=5*scroll.bar["picture"+i].pic._height/200;
    scroll.bar["picture"+i]._y+=5*scroll.bar["picture"+i].pic._width/200;
    scroll.bar["picture"+i].background._height=scroll.bar["picture"+i].pic._height+(2*borderSize);
    scroll.bar["picture"+i].background._width=scroll.bar["picture"+i].pic._width+(2*borderSize);
    if (scroll.bar["picture"+i]._height<=BarHeight){
    scroll.bar["picture"+i].pic._width=scroll.bar["picture"+i].pic.width;
    scroll.bar["picture"+i].pic._height=scroll.bar["picture"+i].pic.height;
    scroll.bar["picture"+i]._x=scroll.bar["picture"+i].x;
    scroll.bar["picture"+i]._y=scroll.bar["picture"+i].y;
    scroll.bar["picture"+i].background._height=scroll.bar["picture"+i].pic._height+(2*borderSize);
    scroll.bar["picture"+i].background._width=scroll.bar["picture"+i].pic._width+(2*borderSize);
    }
    }
    if ((efect==3)&&(scroll.bar["picture"+i]._height>BarHeight)&&(background!=true)){
    scroll.bar["picture"+i].swapDepths(i);
    scroll.bar["picture"+i].pic._height-=5*scroll.bar["picture"+i].pic._height/100;
    scroll.bar["picture"+i]._y+=5*scroll.bar["picture"+i].pic._width/200;
    scroll.bar["picture"+i].pic._width-=5*scroll.bar["picture"+i].pic._width/100;
    scroll.bar["picture"+i]._x+=5*scroll.bar["picture"+i].pic._height/200;
    if (scroll.bar["picture"+i]._height<=BarHeight){
    scroll.bar["picture"+i].pic._width=scroll.bar["picture"+i].pic.width;
    scroll.bar["picture"+i].pic._height=scroll.bar["picture"+i].pic.height;
    scroll.bar["picture"+i]._x=scroll.bar["picture"+i].x;
    scroll.bar["picture"+i]._y=scroll.bar["picture"+i].y;
    }
    }
    }
    }

    firstWidth=scroll.bar["picture"+0]._width;
    lastWidth=scroll.bar["picture"+(xml.firstChild.childNodes.length-1)]._width;

    if ((this._ymouse>0)&&(this._ymouse<BarHeightOver)&&( this._xmouse>=0)&&(this._xmouse<=BarWidth)){
    xmouse=this._xmouse;
    }

    if (((xmouse-firstWidth)>0)&&((xmouse+lastWidth)<BarWidth)){
    scroll.bar._x-=(Math.abs((((width+WidthSpacing)-BarWidth)/BarWidth)*(xmouse-lastWidth+(firstWidth+lastWidth)*(xmouse/(BarWidth-lastWidth))))-Math.abs(scroll.bar._x-this._x))/10;
    }
    if ((xmouse-firstWidth)<0){
    if (scroll.bar._x<this._x)
    scroll.bar._x+=(Math.abs(scroll.bar._x)+this._x)/10;
    }
    if ((xmouse+lastWidth)>BarWidth){
    if (scroll.bar._x>-((width+WidthSpacing)-BarWidth-this._x))
    scroll.bar._x-=(((width+WidthSpacing)-BarWidth-this._x)+scroll.bar._x)/10;
    }
    }

    }

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    please format you code with code tags

    and is it NOT supposed to be random? or is it?

    I dont understand the problem or question?

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