Small action script help
- routhu
- Beginner


- Joined: Feb 28, 2007
- Posts: 47
- Loc: India
- Status: Offline
hi all,
I am using below script for xml thumnail gallery. Displaying of images is coming fine, I need to disply each title when roll over the image. That added in code but it's not working. Iam little bit confused.
Can any one help please.
I am using below script for xml thumnail gallery. Displaying of images is coming fine, I need to disply each title when roll over the image. That added in code but it's not working. Iam little bit confused.
Can any one help please.
Code: [ Select ]
function thumbnailsLoad(k)
{
thumbnailsWidth = mclThumbnails._width;
mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
var __reg4 = new MovieClipLoader();
var __reg3 = new Object();
__reg3.onLoadInit = function (mclTarget)
{
mclTarget._alpha = 100;
var __reg4 = undefined;
var __reg5 = undefined;
__reg4 = mclTarget._x;
__reg5 = mclTarget._y;
mclTarget.onRollOver = function ()
{
_root.is_move = false;
this._alpha = 80;
this._parent._parent.gotoAndPlay("show");
this.caption.text = titleText[k];
trace(caption.text);
}
;
{
thumbnailsWidth = mclThumbnails._width;
mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
var __reg4 = new MovieClipLoader();
var __reg3 = new Object();
__reg3.onLoadInit = function (mclTarget)
{
mclTarget._alpha = 100;
var __reg4 = undefined;
var __reg5 = undefined;
__reg4 = mclTarget._x;
__reg5 = mclTarget._y;
mclTarget.onRollOver = function ()
{
_root.is_move = false;
this._alpha = 80;
this._parent._parent.gotoAndPlay("show");
this.caption.text = titleText[k];
trace(caption.text);
}
;
- function thumbnailsLoad(k)
- {
- thumbnailsWidth = mclThumbnails._width;
- mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
- var __reg4 = new MovieClipLoader();
- var __reg3 = new Object();
- __reg3.onLoadInit = function (mclTarget)
- {
- mclTarget._alpha = 100;
- var __reg4 = undefined;
- var __reg5 = undefined;
- __reg4 = mclTarget._x;
- __reg5 = mclTarget._y;
- mclTarget.onRollOver = function ()
- {
- _root.is_move = false;
- this._alpha = 80;
- this._parent._parent.gotoAndPlay("show");
- this.caption.text = titleText[k];
- trace(caption.text);
- }
- ;
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
July 30th, 2007, 4:07 am
- routhu
- Beginner


- Joined: Feb 28, 2007
- Posts: 47
- Loc: India
- Status: Offline
This is the I am using code:
Code: [ Select ]
function loadPhotoXML(filename)
{
photoXML.ignoreWhite = true;
photoXML.load(filename);
photoXML.onLoad = function (success)
{
if (success)
{
photoNumber = 0;
rootNode = this.firstChild;
totalPhotos = rootNode.childNodes.length;
var __reg2 = 0;
while (__reg2 < totalPhotos * 2)
{
if (__reg2 < totalPhotos)
{
thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
}
else
{
thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
}
thumbnailsLoad(__reg2);
++__reg2;
}
checkProgressLoad(0);
//caption.text = titleText[0];
}
}
;
}
function thumbnailsLoad(k)
{
thumbnailsWidth = mclThumbnails._width;
mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
var __reg4 = new MovieClipLoader();
var __reg3 = new Object();
__reg3.onLoadInit = function (mclTarget)
{
mclTarget._alpha = 100;
var __reg4 = undefined;
var __reg5 = undefined;
__reg4 = mclTarget._x;
__reg5 = mclTarget._y;
mclTarget.onRollOver = function ()
{
_root.is_move = false;
this._alpha = 80;
this._parent._parent.gotoAndPlay("show");
_root.mclThumbnails.mclTarget.caption.text = titleText[k];
trace(caption.text);
}
;
mclTarget.onRollOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
mclTarget.onDragOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
{
photoXML.ignoreWhite = true;
photoXML.load(filename);
photoXML.onLoad = function (success)
{
if (success)
{
photoNumber = 0;
rootNode = this.firstChild;
totalPhotos = rootNode.childNodes.length;
var __reg2 = 0;
while (__reg2 < totalPhotos * 2)
{
if (__reg2 < totalPhotos)
{
thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
}
else
{
thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
}
thumbnailsLoad(__reg2);
++__reg2;
}
checkProgressLoad(0);
//caption.text = titleText[0];
}
}
;
}
function thumbnailsLoad(k)
{
thumbnailsWidth = mclThumbnails._width;
mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
var __reg4 = new MovieClipLoader();
var __reg3 = new Object();
__reg3.onLoadInit = function (mclTarget)
{
mclTarget._alpha = 100;
var __reg4 = undefined;
var __reg5 = undefined;
__reg4 = mclTarget._x;
__reg5 = mclTarget._y;
mclTarget.onRollOver = function ()
{
_root.is_move = false;
this._alpha = 80;
this._parent._parent.gotoAndPlay("show");
_root.mclThumbnails.mclTarget.caption.text = titleText[k];
trace(caption.text);
}
;
mclTarget.onRollOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
mclTarget.onDragOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
- function loadPhotoXML(filename)
- {
- photoXML.ignoreWhite = true;
- photoXML.load(filename);
- photoXML.onLoad = function (success)
- {
- if (success)
- {
- photoNumber = 0;
- rootNode = this.firstChild;
- totalPhotos = rootNode.childNodes.length;
- var __reg2 = 0;
- while (__reg2 < totalPhotos * 2)
- {
- if (__reg2 < totalPhotos)
- {
- thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
- link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
- titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
- }
- else
- {
- thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
- link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
- titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
- }
- thumbnailsLoad(__reg2);
- ++__reg2;
- }
- checkProgressLoad(0);
- //caption.text = titleText[0];
- }
- }
- ;
- }
- function thumbnailsLoad(k)
- {
- thumbnailsWidth = mclThumbnails._width;
- mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
- var __reg4 = new MovieClipLoader();
- var __reg3 = new Object();
- __reg3.onLoadInit = function (mclTarget)
- {
- mclTarget._alpha = 100;
- var __reg4 = undefined;
- var __reg5 = undefined;
- __reg4 = mclTarget._x;
- __reg5 = mclTarget._y;
- mclTarget.onRollOver = function ()
- {
- _root.is_move = false;
- this._alpha = 80;
- this._parent._parent.gotoAndPlay("show");
- _root.mclThumbnails.mclTarget.caption.text = titleText[k];
- trace(caption.text);
- }
- ;
- mclTarget.onRollOut = function ()
- {
- _root.is_move = true;
- this._alpha = 95;
- this._parent._parent.gotoAndPlay("hide");
- }
- ;
- mclTarget.onDragOut = function ()
- {
- _root.is_move = true;
- this._alpha = 95;
- this._parent._parent.gotoAndPlay("hide");
- }
- ;
- routhu
- Beginner


- Joined: Feb 28, 2007
- Posts: 47
- Loc: India
- Status: Offline
- graphixboy
- Control + Z


- Joined: Jul 11, 2005
- Posts: 1828
- Loc: In the Great White North
- Status: Offline
what does your xml look like? I usually use item attributes instead of child objects since its easier to get to in flash.
<xml etc>
<images>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
</images>
Then when you load the xml make it into an array. Its a lot easier to deal with instead of all the crazy if statements your using.
So you want something like this...
I know that means changing quite a bit of your code now but it will probably be a lot easier for you down the road.
Code: [ Select ]
<xml etc>
<images>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
<item URL="pathToFile" tName="Name for the Thumbnail"></item>
</images>
- <xml etc>
- <images>
- <item URL="pathToFile" tName="Name for the Thumbnail"></item>
- <item URL="pathToFile" tName="Name for the Thumbnail"></item>
- <item URL="pathToFile" tName="Name for the Thumbnail"></item>
- <item URL="pathToFile" tName="Name for the Thumbnail"></item>
- <item URL="pathToFile" tName="Name for the Thumbnail"></item>
- </images>
Then when you load the xml make it into an array. Its a lot easier to deal with instead of all the crazy if statements your using.
So you want something like this...
Code: [ Select ]
mainContent_xml.onLoad = function(success) {
if (success) {
_root.myContent = mainContent_xml.firstChild.childNodes;
myFunction();
} else {
trace("Error loading mainContent_xml");
}
};
function myFunction()
{
// loop through the list and do something with them
for(i=0;i<_root.myContent.length;i++)
{
trace("URL for current xmlNode is: "+_root.myContent[i].attributes.URL);
trace("Name for curr xmlNode is: "+_root.myContent[i].attributes.tName);
}
}
if (success) {
_root.myContent = mainContent_xml.firstChild.childNodes;
myFunction();
} else {
trace("Error loading mainContent_xml");
}
};
function myFunction()
{
// loop through the list and do something with them
for(i=0;i<_root.myContent.length;i++)
{
trace("URL for current xmlNode is: "+_root.myContent[i].attributes.URL);
trace("Name for curr xmlNode is: "+_root.myContent[i].attributes.tName);
}
}
- mainContent_xml.onLoad = function(success) {
- if (success) {
- _root.myContent = mainContent_xml.firstChild.childNodes;
- myFunction();
- } else {
- trace("Error loading mainContent_xml");
- }
- };
- function myFunction()
- {
- // loop through the list and do something with them
- for(i=0;i<_root.myContent.length;i++)
- {
- trace("URL for current xmlNode is: "+_root.myContent[i].attributes.URL);
- trace("Name for curr xmlNode is: "+_root.myContent[i].attributes.tName);
- }
- }
I know that means changing quite a bit of your code now but it will probably be a lot easier for you down the road.
- routhu
- Beginner


- Joined: Feb 28, 2007
- Posts: 47
- Loc: India
- Status: Offline
Hi,
Thanks for your reply, this is my xml code: I am getting "alt" in xml to flash file. But I am not able to display that one in below the image.
<?xml version="1.0" standalone="yes" ?>
<PhotoGallery>
<photo>
<thumbnails>images/img1.jpg</thumbnails>
<url>http://wwww.1.com/</url>
<alt>Image 1</alt>
</photo>
<photo>
<thumbnails>images/img2.jpg</thumbnails>
<url>http://wwww.2.com/</url>
<alt>Image 2</alt>
</photo></PhotoGallery>
This is my actionscript, could you please tell me where I can modify my code and how?
Thanks
Thanks for your reply, this is my xml code: I am getting "alt" in xml to flash file. But I am not able to display that one in below the image.
Code: [ Select ]
<?xml version="1.0" standalone="yes" ?>
<PhotoGallery>
<photo>
<thumbnails>images/img1.jpg</thumbnails>
<url>http://wwww.1.com/</url>
<alt>Image 1</alt>
</photo>
<photo>
<thumbnails>images/img2.jpg</thumbnails>
<url>http://wwww.2.com/</url>
<alt>Image 2</alt>
</photo></PhotoGallery>
- <?xml version="1.0" standalone="yes" ?>
- <PhotoGallery>
- <photo>
- <thumbnails>images/img1.jpg</thumbnails>
- <url>http://wwww.1.com/</url>
- <alt>Image 1</alt>
- </photo>
- <photo>
- <thumbnails>images/img2.jpg</thumbnails>
- <url>http://wwww.2.com/</url>
- <alt>Image 2</alt>
- </photo></PhotoGallery>
This is my actionscript, could you please tell me where I can modify my code and how?
Code: [ Select ]
mclThumbnails.dx = 0.01;
var mclWidth = 104;
var screenCenter = 450;
var acceleration = 100;
var deceleration = 0.999;
var leastSpeed = 2;
////////////////////////////////////////////////
var photoXML = new XML();
var photoNumber;
var rootNode;
var totalPhotos;
var ids;
var thumbnails = [];
var link = [];
var titleText = [];
var thumbnailsWidth;
var is_move = true;
var i = 0;
var nInterval;
var nRow = 0;
///////////////////////////////////////////////
function loadPhotoXML(filename)
{
photoXML.ignoreWhite = true;
photoXML.load(filename);
photoXML.onLoad = function (success)
{
if (success)
{
photoNumber = 0;
rootNode = this.firstChild;
totalPhotos = rootNode.childNodes.length;
var __reg2 = 0;
while (__reg2 < totalPhotos * 2)
{
if (__reg2 < totalPhotos)
{
thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
}
else
{
thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
}
thumbnailsLoad(__reg2);
++__reg2;
}
checkProgressLoad(0);
//caption.text = titleText[0];
}
}
;
}
function thumbnailsLoad(k)
{
thumbnailsWidth = mclThumbnails._width;
mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
var __reg4 = new MovieClipLoader();
this.caption.text = titleText[k]
trace(caption.text);
var __reg3 = new Object();
__reg3.onLoadInit = function (mclTarget)
{
mclTarget._alpha = 100;
var __reg4 = undefined;
var __reg5 = undefined;
__reg4 = mclTarget._x;
__reg5 = mclTarget._y;
mclTarget.onRollOver = function ()
{
_root.is_move = false;
this._alpha = 80;
this._parent._parent.gotoAndPlay("show");
caption.text = titleText[k];
trace(caption.text);
}
;
mclTarget.onRollOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
mclTarget.onDragOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
mclTarget.onPress = function ()
{
if(ids!=k) {
checkProgressLoad(k);
getURL(link[k], "_self");
trace(link[k]);
ids=k;
}
}
;
}
;
__reg3.onLoadProgress = function (mclTarget, nLoaded, nTotal)
{
if (nLoaded != nTotal)
{
preloader._visible = true;
preloader.textf.text = "Thumbnails loading";
return;
}
}
;
__reg4.addListener(__reg3);
mclThumbnails["mcl" + k].mclLoadPicture.createEmptyMovieClip("temp", this.getNextHighestDepth());
__reg4.loadClip(thumbnails[k], "mclThumbnails.mcl" + k + ".mclLoadPicture.temp");
thumbnailsWidth = mclWidth * totalPhotos;
}
function ff(j)
{
++nRow;
_root.mcHolder1.attachMovie("simplesquare", "mcsquare", _root.mcHolder1.getNextHighestDepth(), {_x: 13, _y: 0 + 12 * nRow});
_root.mcHolder1.mcsquare1._y = 6 + 12 * nRow;
if (nRow > 37)
{
removeMovieClip(_root.mcHolder1);
clearInterval(nInterval);
removeMovieClip(mclPicture["mcl" + j]);
nRow = 0;
}
}
function checkProgressLoad(k)
{
var __reg3 = new MovieClipLoader();
var __reg2 = new Object();
mclPicture.attachMovie("imageSymbol", "mcl" + i, 1000 - (i + 1));
mclPicture["mcl" + i].mclLoadPicture.createEmptyMovieClip("temp", mclPicture["mcl" + i].mclLoadPicture.getNextHighestDepth());
__reg2.onLoadStart = function (mclTarget)
{
preloader._visible = true;
}
;
__reg2.onLoadProgress = function (mclTarget, nLoaded, nTotal)
{
preloader.bar._alpha = 100;
preloader.bar._width = nLoaded / nTotal * 600;
preloader.textf.text = "Loaded " + Math.floor(nLoaded / 1000) + "Kb of " + Math.floor(nTotal / 1000) + " Kb";
}
;
__reg2.onLoadComplete = function (mclTarget)
{
preloader.bar._width = 20;
preloader._visible = false;
mclTarget._parent._parent.gotoAndPlay("start_play");
if (i > 0)
{
nRow = 0;
clearInterval(nInterval);
removeMovieClip(_root.mcHolder1);
removeMovieClip(mclPicture["mcl" + (i - 2)]);
_root.createEmptyMovieClip("mcHolder1", _root.getNextHighestDepth());
_root.mcHolder1.attachMovie("mask_square", "mcsquare1", _root.mcHolder1.getNextHighestDepth());
_root.mcHolder1.mcsquare1._x = 0;
_root.mcHolder1.mcsquare1._y = 0;
_root.mcHolder1.mcsquare1._width = 600;
_root.mcHolder1.mcsquare1._height = 600;
mclPicture["mcl" + (i - 1)].mclLoadPicture.setMask(mcHolder1);
nInterval = setInterval(ff, 48, i - 1);
}
++i;
}
;
__reg3.addListener(__reg2);
if (k < totalPhotos)
{
__reg3.loadClip(url[k], "mclPicture.mcl" + i + ".mclLoadPicture.temp");
return;
}
__reg3.loadClip(url[k - totalPhotos], "mclPicture.mcl" + i + ".mclLoadPicture.temp");
}
function thumbnailsRoll()
{
if (mclThumbnails.hitTest(_root._xmouse, _root._ymouse, 0))
{
mclThumbnails.dx = (_root._xmouse - screenCenter) / acceleration;
}
if (_root.is_move)
{
mclThumbnails.dx = mclThumbnails.dx * deceleration;
if (Math.abs(mclThumbnails.dx) < leastSpeed)
{
if (mclThumbnails.dx > 0)
{
mclThumbnails.dx = leastSpeed;
}
else
{
mclThumbnails.dx = 0 - leastSpeed;
}
}
mclThumbnails._x = mclThumbnails._x - mclThumbnails.dx;
if (mclThumbnails._x < 0 - thumbnailsWidth)
{
mclThumbnails._x = mclThumbnails._x + thumbnailsWidth;
}
if (mclThumbnails._x > 0)
{
mclThumbnails._x = mclThumbnails._x - thumbnailsWidth;
}
}
}
loadPhotoXML("photoslist.xml");
mclThumbnails.onEnterFrame = function ()
{
thumbnailsRoll();
}
;
var mclWidth = 104;
var screenCenter = 450;
var acceleration = 100;
var deceleration = 0.999;
var leastSpeed = 2;
////////////////////////////////////////////////
var photoXML = new XML();
var photoNumber;
var rootNode;
var totalPhotos;
var ids;
var thumbnails = [];
var link = [];
var titleText = [];
var thumbnailsWidth;
var is_move = true;
var i = 0;
var nInterval;
var nRow = 0;
///////////////////////////////////////////////
function loadPhotoXML(filename)
{
photoXML.ignoreWhite = true;
photoXML.load(filename);
photoXML.onLoad = function (success)
{
if (success)
{
photoNumber = 0;
rootNode = this.firstChild;
totalPhotos = rootNode.childNodes.length;
var __reg2 = 0;
while (__reg2 < totalPhotos * 2)
{
if (__reg2 < totalPhotos)
{
thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
}
else
{
thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
}
thumbnailsLoad(__reg2);
++__reg2;
}
checkProgressLoad(0);
//caption.text = titleText[0];
}
}
;
}
function thumbnailsLoad(k)
{
thumbnailsWidth = mclThumbnails._width;
mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
var __reg4 = new MovieClipLoader();
this.caption.text = titleText[k]
trace(caption.text);
var __reg3 = new Object();
__reg3.onLoadInit = function (mclTarget)
{
mclTarget._alpha = 100;
var __reg4 = undefined;
var __reg5 = undefined;
__reg4 = mclTarget._x;
__reg5 = mclTarget._y;
mclTarget.onRollOver = function ()
{
_root.is_move = false;
this._alpha = 80;
this._parent._parent.gotoAndPlay("show");
caption.text = titleText[k];
trace(caption.text);
}
;
mclTarget.onRollOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
mclTarget.onDragOut = function ()
{
_root.is_move = true;
this._alpha = 95;
this._parent._parent.gotoAndPlay("hide");
}
;
mclTarget.onPress = function ()
{
if(ids!=k) {
checkProgressLoad(k);
getURL(link[k], "_self");
trace(link[k]);
ids=k;
}
}
;
}
;
__reg3.onLoadProgress = function (mclTarget, nLoaded, nTotal)
{
if (nLoaded != nTotal)
{
preloader._visible = true;
preloader.textf.text = "Thumbnails loading";
return;
}
}
;
__reg4.addListener(__reg3);
mclThumbnails["mcl" + k].mclLoadPicture.createEmptyMovieClip("temp", this.getNextHighestDepth());
__reg4.loadClip(thumbnails[k], "mclThumbnails.mcl" + k + ".mclLoadPicture.temp");
thumbnailsWidth = mclWidth * totalPhotos;
}
function ff(j)
{
++nRow;
_root.mcHolder1.attachMovie("simplesquare", "mcsquare", _root.mcHolder1.getNextHighestDepth(), {_x: 13, _y: 0 + 12 * nRow});
_root.mcHolder1.mcsquare1._y = 6 + 12 * nRow;
if (nRow > 37)
{
removeMovieClip(_root.mcHolder1);
clearInterval(nInterval);
removeMovieClip(mclPicture["mcl" + j]);
nRow = 0;
}
}
function checkProgressLoad(k)
{
var __reg3 = new MovieClipLoader();
var __reg2 = new Object();
mclPicture.attachMovie("imageSymbol", "mcl" + i, 1000 - (i + 1));
mclPicture["mcl" + i].mclLoadPicture.createEmptyMovieClip("temp", mclPicture["mcl" + i].mclLoadPicture.getNextHighestDepth());
__reg2.onLoadStart = function (mclTarget)
{
preloader._visible = true;
}
;
__reg2.onLoadProgress = function (mclTarget, nLoaded, nTotal)
{
preloader.bar._alpha = 100;
preloader.bar._width = nLoaded / nTotal * 600;
preloader.textf.text = "Loaded " + Math.floor(nLoaded / 1000) + "Kb of " + Math.floor(nTotal / 1000) + " Kb";
}
;
__reg2.onLoadComplete = function (mclTarget)
{
preloader.bar._width = 20;
preloader._visible = false;
mclTarget._parent._parent.gotoAndPlay("start_play");
if (i > 0)
{
nRow = 0;
clearInterval(nInterval);
removeMovieClip(_root.mcHolder1);
removeMovieClip(mclPicture["mcl" + (i - 2)]);
_root.createEmptyMovieClip("mcHolder1", _root.getNextHighestDepth());
_root.mcHolder1.attachMovie("mask_square", "mcsquare1", _root.mcHolder1.getNextHighestDepth());
_root.mcHolder1.mcsquare1._x = 0;
_root.mcHolder1.mcsquare1._y = 0;
_root.mcHolder1.mcsquare1._width = 600;
_root.mcHolder1.mcsquare1._height = 600;
mclPicture["mcl" + (i - 1)].mclLoadPicture.setMask(mcHolder1);
nInterval = setInterval(ff, 48, i - 1);
}
++i;
}
;
__reg3.addListener(__reg2);
if (k < totalPhotos)
{
__reg3.loadClip(url[k], "mclPicture.mcl" + i + ".mclLoadPicture.temp");
return;
}
__reg3.loadClip(url[k - totalPhotos], "mclPicture.mcl" + i + ".mclLoadPicture.temp");
}
function thumbnailsRoll()
{
if (mclThumbnails.hitTest(_root._xmouse, _root._ymouse, 0))
{
mclThumbnails.dx = (_root._xmouse - screenCenter) / acceleration;
}
if (_root.is_move)
{
mclThumbnails.dx = mclThumbnails.dx * deceleration;
if (Math.abs(mclThumbnails.dx) < leastSpeed)
{
if (mclThumbnails.dx > 0)
{
mclThumbnails.dx = leastSpeed;
}
else
{
mclThumbnails.dx = 0 - leastSpeed;
}
}
mclThumbnails._x = mclThumbnails._x - mclThumbnails.dx;
if (mclThumbnails._x < 0 - thumbnailsWidth)
{
mclThumbnails._x = mclThumbnails._x + thumbnailsWidth;
}
if (mclThumbnails._x > 0)
{
mclThumbnails._x = mclThumbnails._x - thumbnailsWidth;
}
}
}
loadPhotoXML("photoslist.xml");
mclThumbnails.onEnterFrame = function ()
{
thumbnailsRoll();
}
;
- mclThumbnails.dx = 0.01;
- var mclWidth = 104;
- var screenCenter = 450;
- var acceleration = 100;
- var deceleration = 0.999;
- var leastSpeed = 2;
- ////////////////////////////////////////////////
- var photoXML = new XML();
- var photoNumber;
- var rootNode;
- var totalPhotos;
- var ids;
- var thumbnails = [];
- var link = [];
- var titleText = [];
- var thumbnailsWidth;
- var is_move = true;
- var i = 0;
- var nInterval;
- var nRow = 0;
- ///////////////////////////////////////////////
- function loadPhotoXML(filename)
- {
- photoXML.ignoreWhite = true;
- photoXML.load(filename);
- photoXML.onLoad = function (success)
- {
- if (success)
- {
- photoNumber = 0;
- rootNode = this.firstChild;
- totalPhotos = rootNode.childNodes.length;
- var __reg2 = 0;
- while (__reg2 < totalPhotos * 2)
- {
- if (__reg2 < totalPhotos)
- {
- thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
- link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
- titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
- }
- else
- {
- thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
- link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
- titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
- }
- thumbnailsLoad(__reg2);
- ++__reg2;
- }
- checkProgressLoad(0);
- //caption.text = titleText[0];
- }
- }
- ;
- }
- function thumbnailsLoad(k)
- {
- thumbnailsWidth = mclThumbnails._width;
- mclThumbnails.attachMovie("scrollSymbol", "mcl" + k, mclThumbnails.getNextHighestDepth(), {_x: mclWidth * k});
- var __reg4 = new MovieClipLoader();
- this.caption.text = titleText[k]
- trace(caption.text);
- var __reg3 = new Object();
- __reg3.onLoadInit = function (mclTarget)
- {
- mclTarget._alpha = 100;
- var __reg4 = undefined;
- var __reg5 = undefined;
- __reg4 = mclTarget._x;
- __reg5 = mclTarget._y;
- mclTarget.onRollOver = function ()
- {
- _root.is_move = false;
- this._alpha = 80;
- this._parent._parent.gotoAndPlay("show");
- caption.text = titleText[k];
- trace(caption.text);
- }
- ;
- mclTarget.onRollOut = function ()
- {
- _root.is_move = true;
- this._alpha = 95;
- this._parent._parent.gotoAndPlay("hide");
- }
- ;
- mclTarget.onDragOut = function ()
- {
- _root.is_move = true;
- this._alpha = 95;
- this._parent._parent.gotoAndPlay("hide");
- }
- ;
- mclTarget.onPress = function ()
- {
- if(ids!=k) {
- checkProgressLoad(k);
- getURL(link[k], "_self");
- trace(link[k]);
- ids=k;
- }
- }
- ;
- }
- ;
- __reg3.onLoadProgress = function (mclTarget, nLoaded, nTotal)
- {
- if (nLoaded != nTotal)
- {
- preloader._visible = true;
- preloader.textf.text = "Thumbnails loading";
- return;
- }
- }
- ;
- __reg4.addListener(__reg3);
- mclThumbnails["mcl" + k].mclLoadPicture.createEmptyMovieClip("temp", this.getNextHighestDepth());
- __reg4.loadClip(thumbnails[k], "mclThumbnails.mcl" + k + ".mclLoadPicture.temp");
- thumbnailsWidth = mclWidth * totalPhotos;
- }
- function ff(j)
- {
- ++nRow;
- _root.mcHolder1.attachMovie("simplesquare", "mcsquare", _root.mcHolder1.getNextHighestDepth(), {_x: 13, _y: 0 + 12 * nRow});
- _root.mcHolder1.mcsquare1._y = 6 + 12 * nRow;
- if (nRow > 37)
- {
- removeMovieClip(_root.mcHolder1);
- clearInterval(nInterval);
- removeMovieClip(mclPicture["mcl" + j]);
- nRow = 0;
- }
- }
- function checkProgressLoad(k)
- {
- var __reg3 = new MovieClipLoader();
- var __reg2 = new Object();
- mclPicture.attachMovie("imageSymbol", "mcl" + i, 1000 - (i + 1));
- mclPicture["mcl" + i].mclLoadPicture.createEmptyMovieClip("temp", mclPicture["mcl" + i].mclLoadPicture.getNextHighestDepth());
- __reg2.onLoadStart = function (mclTarget)
- {
- preloader._visible = true;
- }
- ;
- __reg2.onLoadProgress = function (mclTarget, nLoaded, nTotal)
- {
- preloader.bar._alpha = 100;
- preloader.bar._width = nLoaded / nTotal * 600;
- preloader.textf.text = "Loaded " + Math.floor(nLoaded / 1000) + "Kb of " + Math.floor(nTotal / 1000) + " Kb";
- }
- ;
- __reg2.onLoadComplete = function (mclTarget)
- {
- preloader.bar._width = 20;
- preloader._visible = false;
- mclTarget._parent._parent.gotoAndPlay("start_play");
- if (i > 0)
- {
- nRow = 0;
- clearInterval(nInterval);
- removeMovieClip(_root.mcHolder1);
- removeMovieClip(mclPicture["mcl" + (i - 2)]);
- _root.createEmptyMovieClip("mcHolder1", _root.getNextHighestDepth());
- _root.mcHolder1.attachMovie("mask_square", "mcsquare1", _root.mcHolder1.getNextHighestDepth());
- _root.mcHolder1.mcsquare1._x = 0;
- _root.mcHolder1.mcsquare1._y = 0;
- _root.mcHolder1.mcsquare1._width = 600;
- _root.mcHolder1.mcsquare1._height = 600;
- mclPicture["mcl" + (i - 1)].mclLoadPicture.setMask(mcHolder1);
- nInterval = setInterval(ff, 48, i - 1);
- }
- ++i;
- }
- ;
- __reg3.addListener(__reg2);
- if (k < totalPhotos)
- {
- __reg3.loadClip(url[k], "mclPicture.mcl" + i + ".mclLoadPicture.temp");
- return;
- }
- __reg3.loadClip(url[k - totalPhotos], "mclPicture.mcl" + i + ".mclLoadPicture.temp");
- }
- function thumbnailsRoll()
- {
- if (mclThumbnails.hitTest(_root._xmouse, _root._ymouse, 0))
- {
- mclThumbnails.dx = (_root._xmouse - screenCenter) / acceleration;
- }
- if (_root.is_move)
- {
- mclThumbnails.dx = mclThumbnails.dx * deceleration;
- if (Math.abs(mclThumbnails.dx) < leastSpeed)
- {
- if (mclThumbnails.dx > 0)
- {
- mclThumbnails.dx = leastSpeed;
- }
- else
- {
- mclThumbnails.dx = 0 - leastSpeed;
- }
- }
- mclThumbnails._x = mclThumbnails._x - mclThumbnails.dx;
- if (mclThumbnails._x < 0 - thumbnailsWidth)
- {
- mclThumbnails._x = mclThumbnails._x + thumbnailsWidth;
- }
- if (mclThumbnails._x > 0)
- {
- mclThumbnails._x = mclThumbnails._x - thumbnailsWidth;
- }
- }
- }
- loadPhotoXML("photoslist.xml");
- mclThumbnails.onEnterFrame = function ()
- {
- thumbnailsRoll();
- }
- ;
Thanks
- graphixboy
- Control + Z


- Joined: Jul 11, 2005
- Posts: 1828
- Loc: In the Great White North
- Status: Offline
what are you trying to do with this section? I want to make sure I don't break it for you.
Code: [ Select ]
if (success)
{
photoNumber = 0;
rootNode = this.firstChild;
totalPhotos = rootNode.childNodes.length;
var __reg2 = 0;
while (__reg2 < totalPhotos * 2)
{
if (__reg2 < totalPhotos)
{
thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
}
else
{
thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
}
thumbnailsLoad(__reg2);
++__reg2;
}
checkProgressLoad(0);
//caption.text = titleText[0];
}
{
photoNumber = 0;
rootNode = this.firstChild;
totalPhotos = rootNode.childNodes.length;
var __reg2 = 0;
while (__reg2 < totalPhotos * 2)
{
if (__reg2 < totalPhotos)
{
thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
}
else
{
thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
}
thumbnailsLoad(__reg2);
++__reg2;
}
checkProgressLoad(0);
//caption.text = titleText[0];
}
- if (success)
- {
- photoNumber = 0;
- rootNode = this.firstChild;
- totalPhotos = rootNode.childNodes.length;
- var __reg2 = 0;
- while (__reg2 < totalPhotos * 2)
- {
- if (__reg2 < totalPhotos)
- {
- thumbnails[__reg2] = rootNode.childNodes[__reg2].childNodes[0].firstChild.nodeValue;
- link[__reg2] = rootNode.childNodes[__reg2].childNodes[1].firstChild.nodeValue;
- titleText[__reg2] = rootNode.childNodes[__reg2].childNodes[2].firstChild.nodeValue;
- }
- else
- {
- thumbnails[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[0].firstChild.nodeValue;
- link[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[1].firstChild.nodeValue;
- titleText[__reg2] = rootNode.childNodes[__reg2 - totalPhotos].childNodes[2].firstChild.nodeValue;
- }
- thumbnailsLoad(__reg2);
- ++__reg2;
- }
- checkProgressLoad(0);
- //caption.text = titleText[0];
- }
- routhu
- Beginner


- Joined: Feb 28, 2007
- Posts: 47
- Loc: India
- Status: Offline
- routhu
- Beginner


- Joined: Feb 28, 2007
- Posts: 47
- Loc: India
- Status: Offline
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 9 posts
- Users browsing this forum: No registered users and 72 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
