PDA

View Full Version : How insert URl in this script ...



geldesigns
01-25-2007, 10:11 PM
function init()
{
this[1].pressed = 0;
this.stopDrag();
this.attachMovie("loading", "loading", 10000);
screen.original.loadMovie(url + "image/image1.jpg");
this.onEnterFrame = function ()
{
if (screen.original.getBytesTotal() == screen.original.getBytesLoaded())
{
this.loading.removeMovieClip();
screen.gotoAndPlay(2);
delete this["onEnterFrame"];
} // end if
};
check.target = 1;
check.onEnterFrame = function ()
{
this._x = this._x + (this._parent[this.target]._x - this._x) / 4;
this._y = this._y + (this._parent[this.target]._y - this._y) / 4;
};
} // End of the function
_global.numOfImage = 20;
url = "";
temp = 10;
check.swapDepths(20000);
var i = 1;
while (i <= numOfImage)
{
mc = this.attachMovie("btn", i, i + 100);
mc._x = (i - 1) % temp * 75 + 30;
mc._y = Math.floor((i - 1) / temp) * 46 + 450;
mc.oldx = mc._x;
mc.oldy = mc._y;
mc.point.loadMovie(url + "thumb/image" + i + ".jpg");
mc.onRollOver = function ()
{
this.fade.play();
check.target = this._name;
check.onEnterFrame = function ()
{
this._x = this._x + (this._parent[this.target]._x - this._x) / 4;
this._y = this._y + (this._parent[this.target]._y - this._y) / 4;
};
};
mc.onRelease = function ()
{
this._parent.attachMovie("loading", "loading", 10000);
screen.original.loadMovie(url + "image/image" + this._name + ".jpg");
this._parent.onEnterFrame = function ()
{
if (screen.original.getBytesTotal() == screen.original.getBytesLoaded())
{
this.loading.removeMovieClip();
screen.gotoAndPlay(2);
delete this["onEnterFrame"];
} // end if
};
};
i++;
} // end while
init();

BLiZZaRD
01-26-2007, 02:38 AM
Your url= here:



_global.numOfImage = 20;
url = "";
temp = 10;


Needs to be a global variable.

Something like this:



_global.numOfImage = 20;
_global.domainName = "http://dynamicdrive.com";
temp = 10;


Then when ever you call it and need to add folders or pages or other variables you would do something like:



on(release){
getURL(_global.domainName+"/forums/", "_blank");
}


(in the case of on a button here)

or to use your script:



screen.original.loadMovie(_global.domainName + "image/image" + this._name + ".jpg");


just be careful where you put your folder separators. For instance in the variable definition, if you use http://dynamicdrive.com/ then when you add folders in your ActionScript DON'T start the folder name with a / (like /forums/ ) just use "forums/"

Hope it helps :D