Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

actionscript help

  • 31-12-2007 04:10AM
    #1
    Registered Users, Registered Users 2 Posts: 714 ✭✭✭


    hi. if anyone is handy with actionscript, please lend a hand. I have a slideshow using flash actionscript and xml. here's the AS
    import com.mosesSupposes.fuse.*;
    import mx.utils.Delegate;
    import flash.display.BitmapData;
    import flash.geom.*;
    
    ZigoEngine.register(Fuse, FuseFMP, PennerEasing);
    
    textBar.swapDepths(10);
    
    var photos:Array = new Array();
    var caps:Array = new Array();
    var current:Number = 0;
    
    this.createEmptyMovieClip("gallery", 1);
    this.gallery.createEmptyMovieClip("bmdc", 1);
    this.gallery.createEmptyMovieClip("photo", 2);
    
    var bmd:BitmapData = new BitmapData(330, 210,true,0x000000);
    this.gallery.bmdc.createEmptyMovieClip("preload", 1);
    this.gallery.bmdc.attachBitmap(bmd, 2);
    
    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclL:Object = new Object();
    mclL.onLoadComplete = Delegate.create(this, tranny);
    mcl.addListener(mclL);
    
    function loadPhoto():Void
    {
        trace("loading photo...");
        bmd.draw(this.gallery.photo);
        this.gallery.photo._alpha = 0;
        if(current == photos.length-1) current = 0;
        else current++;
        textbar._rotation = rr;
        textBar.t.text = caps[current];
        mcl.loadClip(photos[current], this.gallery.photo);
    }
    
    function preload():Void
    {
        if(current == photos.length-1) var num = 0;
        else var num = current+1;
        this.gallery.bmdc.preload.loadMovie(photos[num]);
    }
    
    function tranny():Void
    {
        trace("starting transition...");
        var f:Fuse = new Fuse();
        f.push([{target:this.gallery.photo, alpha:100, time:2},
                    {target:textBar, delay:0.5, start_x:-518, x:cx, time:0.5, ease:"easeOutExpo"},
                    {target:textBar.arrow, x:ca, time:0.5, ease:"easeOutQuad", delay:0.5}]);
        f.push({func:preload, scope:this});
        f.push({target:textBar,delay:5, x:-518, time:1, ease:"easeOutExpo", func:loadPhoto, scope:this});
        f.start();
    }
    
    function cx():Number
    {
        var te:Number = textBar.t.textWidth;
        var nx:Number = -518  + te + 60;
        return nx;
    }
    
    function ca():Number
    {
        return textBar.t._x - cx()+27;
    }
    
    function rr():Number
    {
        if(Math.random() < 0.5) return Math.round(Math.random()*15);
        else return Math.round(-Math.random()*15);
    }
    
    var feed:XML = new XML();
    feed.ignoreWhite = true;
    feed.onLoad = function()
    {
        var nodes:Array = this.firstChild.childNodes;
        for(var i=0;i<nodes.length;i++)
        {
            _root.caps.push(nodes[i].attributes.desc);
            _root.photos.push(nodes[i].attributes.url);
        }
        _root.mcl.loadClip(photos[0], _root.gallery.photo);
        _root.textBar.t.text = caps[0];
    }
    
    feed.load("photos.xml");
    

    XML looks like so
    <photos>
    
    <photo url="one.jpg" desc="La Caletas - &#8364;104,735" />
    
    </photos>
    

    I want to change it so that it looks like so
    <photos>
    
    <photo url="one.jpg" desc="La Caletas - &#8364;104,735" link="http://www.site.com" />
    
    </photos>
    

    SO basically on the onRelease of the 'textBar' movie clip I would like to be redirected to the specified url.

    I think it might go something like this
    textBar.onRelease = function() {
    		getURL(link[i], "_blank");
    	};
    

    but im completely new to AS and haven't the slightest idea.

    All help is greatly appreciated.


Advertisement