aarondm
02-15-2008, 03:36 AM
Hi, I have an all actionscript area of my webiste that works as an image scroller for visitors to preview the videos.
How can I write code that makes the thumnail images once clicked link to a file on a server?
Here is the code at the moment. Here the larger image opens on click, but i will change that to open when hover , so the link will be accessed via a click instead.
import mx.transitions.Tween;
import mx.transitions.easing.*;
this.createEmptyMovieClip("container",1);
var imagesNumber:Number = 20;
for (i=1; i<=imagesNumber; i++) {
container.attachMovie("thumb"+i,"thumb"+i+"_mc",i);
myThumb_mc = container["thumb"+i+"_mc"];
myThumb_mc._x = (i-1)*myThumb_mc._width;
myThumb_mc._y = (Stage.height-myThumb_mc._height-3)
myThumb_mc._alpha=75;
myThumb_mc.largerImage = i;
myThumb_mc.onRollOver = function(){
this._alpha=100;
}
myThumb_mc.onRollOut = function(){
this._alpha=50;
}
myThumb_mc.onRelease = function() {
_root.attachMovie("image"+this.largerImage,"large_mc",2);
large_mc._x = (Stage.width-large_mc._width)/2;
large_mc._y = (Stage.height-large_mc._height)/2;
large_mc.onRelease = function() {
this.removeMovieClip();
};
};
}
container.onEnterFrame = function() {
this._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*10;
if (this._x>0) {
this._x = 0;
}
if (-this._x>(this._width-Stage.width)) {
this._x = -(this._width-Stage.width);
}
};
How can I write code that makes the thumnail images once clicked link to a file on a server?
Here is the code at the moment. Here the larger image opens on click, but i will change that to open when hover , so the link will be accessed via a click instead.
import mx.transitions.Tween;
import mx.transitions.easing.*;
this.createEmptyMovieClip("container",1);
var imagesNumber:Number = 20;
for (i=1; i<=imagesNumber; i++) {
container.attachMovie("thumb"+i,"thumb"+i+"_mc",i);
myThumb_mc = container["thumb"+i+"_mc"];
myThumb_mc._x = (i-1)*myThumb_mc._width;
myThumb_mc._y = (Stage.height-myThumb_mc._height-3)
myThumb_mc._alpha=75;
myThumb_mc.largerImage = i;
myThumb_mc.onRollOver = function(){
this._alpha=100;
}
myThumb_mc.onRollOut = function(){
this._alpha=50;
}
myThumb_mc.onRelease = function() {
_root.attachMovie("image"+this.largerImage,"large_mc",2);
large_mc._x = (Stage.width-large_mc._width)/2;
large_mc._y = (Stage.height-large_mc._height)/2;
large_mc.onRelease = function() {
this.removeMovieClip();
};
};
}
container.onEnterFrame = function() {
this._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*10;
if (this._x>0) {
this._x = 0;
}
if (-this._x>(this._width-Stage.width)) {
this._x = -(this._width-Stage.width);
}
};