LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
  #1  
Old 06-20-2007, 08:15 PM
umar umar is offline
Registered User
 
Join Date: Jun 2007
Posts: 3
Rep Power: 0
umar is on a distinguished road
error in action script .... please help .....

frame 1 load swf

function load_css(strCssSource)
{
styCSS = new TextField.StyleSheet();
styCSS.onLoad = function (success)
{
if (success)
{
process_structure(intStartId);
objClipBase.gotoSandStop("loadXml");
} // end if
};
styCSS.load(strCssSource);
} // End of the function
objClipBase = this;
_root.objClipBase = this;
if (run_mode == "live")
{
objClipBase.strCssSource = _root.css;
objClipBase.strXmlSource = _root.xml;
objClipBase.strPathToImages = _root.img_folder;
}
else
{
objClipBase.strCssSource = "../css/style_flash.css";
objClipBase.strXmlSource = "../xml/slides.xml";
objClipBase.strPathToImages = "../img/";
} // end else if
mcLoader.onEnterFrame = function ()
{
this._x = _root._xmouse + 10;
this._y = _root._ymouse + 10;
};
_root.createEmptyMovieClip("mcPreloader", 1);
_root.mcPreloader.onEnterFrame = function ()
{
if (_root.getBytesLoaded() >= _root.getBytesTotal())
{
load_css(objClipBase.strCssSource);
_root.mcPreloader.onEnterFrame = null;
} // end if
};


frame : load xml
function load_new_data_set(strUrl)
{
objXml = new XML();
objXml.ignoreWhite = true;
objXml.onLoad = function (success)
{
if (success)
{
objClipBase.process_xml_data(objXml);
} // end if
};
var _loc1 = new Date().getTime();
_loc1 = "?rand=" + _loc1;
_loc1 = "";
objXml.load(strUrl + _loc1);
} // End of the function
function process_xml_data(objXml)
{
objItemData = new Object();
objItemData = XML2Object.deserialize(objXml);
if (objItemData.data.slide == null)
{
arrItems = new Array();
}
else if (objItemData.data.slide instanceof Array)
{
arrItems = objItemData.data.slide;
}
else
{
arrItems = new Array(objItemData.data.slide);
} // end else if
objClipBase.arrData = arrItems;
objClipBase.gotoAndPlay("slideshow");
} // End of the function

load_new_data_set(strXmlSource);
stop ();
  #2  
Old 06-20-2007, 08:17 PM
umar umar is offline
Registered User
 
Join Date: Jun 2007
Posts: 3
Rep Power: 0
umar is on a distinguished road
contt..........

frame slide show:
function jump_to(intIndex)
{
intIndex = Number(intIndex);
objClipBase.mcScroll.intTargetX = -1 * intIndex * intSlideWidth;
objClipBase.mcScroll.onEnterFrame = function ()
{
this._x = this._x + (this.intTargetX - this._x) / 8;
if (Math.abs(this.intTargetX - this._x) <= 1)
{
this._x = this.intTargeX;
this.onEnterFrame = null;
} // end if
};
set_navigation(intIndex);
} // End of the function
function load_images()
{
objClipBase.createEmptyMovieClip("mcScroll", 1);
objClipBase.mcScroll.setMask(mcMask);
for (var _loc1 = 0; _loc1 < arrData.length; ++_loc1)
{
strSource = objClipBase.strPathToImages + arrData[_loc1].image.data;
load_image(strSource, _loc1);
} // end of for
} // End of the function
function load_image(strSource, intIndex)
{
objClipBase.mcScroll["mcImageContainer" + intIndex].removeMovieClip();
objClipBase.mcScroll.createEmptyMovieClip("mcImage Container" + intIndex, intIndex);
objClipBase.mcScroll["mcImageContainer" + intIndex].intIndex = intIndex;
objClipBase.mcScroll["mcImageContainer" + intIndex]._y = intImageY;
objClipBase.mcScroll["mcImageContainer" + intIndex]._x = intIndex * intSlideWidth;
objClipBase.mcScroll["mcImageContainer" + intIndex].createEmptyMovieClip("mcImage", 1);
objClipBase.mcScroll["mcImageContainer" + intIndex].mcImage.loadMovie(strSource);
objClipBase.mcScroll._visible = false;
objClipBase.mcScroll["mcImageContainer" + intIndex].onEnterFrame = function ()
{
if (this._width > 0 && this._height > 0)
{
this.mcImage._x = intSlideWidth / 2 - this._width / 2;
dispatch_ready(this.intIndex);
this.onEnterFrame = null;
} // end if
};
} // End of the function
function dispatch_ready(intIndex)
{
if (!Util.in_array(intIndex, arrLoadedImages))
{
arrLoadedImages.push(intIndex);
} // end if
intPercent = Math.floor(100 * (arrLoadedImages.length / arrData.length));
if (arrLoadedImages.length >= arrData.length / 4 && !blnBufferLoaded)
{
blnBufferLoaded = true;
objClipBase.mcScroll._visible = true;
fade_from_black(objClipBase.mcScroll);
set_navigation(0);
mcLoader.onEnterFrame = null;
mcLoader._visible = false;
} // end if
} // End of the function
function set_buttons()
{
for (i = 0; i < arrButtonLabels.length; i++)
{
strColor = "FFFFFFF";
if (i == 0)
{
strColor = "FF0000";
} // end if
strButtonText = "<font color=\'#" + strColor + "\'><b><a href=\'" + arrButtonHrefs[i] + "\'>" + arrButtonLabels[i] + "</a></b></font>";
objClipBase["mcButton" + i].styleSheet = objClipBase.styCSS;
objClipBase["mcButton" + i].htmlText = strButtonText;
} // end of for
} // End of the function
function set_navigation(intCurrent)
{
intTotal = arrData.length;
if (intCurrent > intTotal)
{
intCurrent = intTotal - 1;
} // end if
if (intCurrent <= 0)
{
intCurrent = 0;
} // end if
intStart = intCurrent - Math.floor((intNavLength - 1) / 2);
if (intStart <= 0)
{
intStart = 0;
} // end if
intStop = intStart + intNavLength;
if (intStop >= intTotal)
{
intStop = intTotal;
} // end if
strNumbers = "";
strSpacer = "";
for (i = intStart; i < intStop; i++)
{
strNumber = i + 1;
if (intCurrent == i)
{
strNumber = "<font color=\'#FFFFFF\'><u>" + strNumber + "</u></font>";
}
else
{
strNumber = "<font color=\'#FFFFFF\'><a href=\'asfunction:_root.jump_to," + i + "\'>" + strNumber + "</a></font>";
} // end else if
strNumbers = strNumbers + strSpacer + strNumber;
strSpacer = " - ";
} // end of for
intBackIndex = intCurrent - 1;
if (intBackIndex < 0)
{
intBackIndex = 0;
} // end if
intFwdIndex = intCurrent + 1;
if (intFwdIndex >= intTotal)
{
intFwdIndex = intTotal - 1;
} // end if
if (intCurrent > 0)
{
strToFirst = "<font color=\'#FF0000\'><a href=\'asfunction:_root.jump_to,0\'>&lt;&lt;</a></font>";
strBack = "<font color=\'#FF0000\'><a href=\'asfunction:_root.jump_to," + intBackIndex + "\'>&lt;</a></font>";
}
else
{
strToFirst = "";
strBack = "";
} // end else if
if (intCurrent < intTotal - 1)
{
strToLast = "<font color=\'#FF0000\'><a href=\'asfunction:_root.jump_to," + (intTotal - 1) + "\'>&gt;&gt;</a></font>";
strFwd = "<font color=\'#FF0000\'><a href=\'asfunction:_root.jump_to," + intFwdIndex + "\'>&gt;</a></font>";
}
else
{
strToLast = "";
strFwd = "";
} // end else if
strSpacer = " ";
mcIndex.styleSheet = objClipBase.styCSS;
mcIndex.htmlText = strSpacer + strBack + strSpacer + strNumbers + strSpacer + strFwd + strSpacer;
} // End of the function
function fade_from_black(objClip)
{
objClip.colorTrans = new flash.geom.ColorTransform();
objClip.colorTrans.blueOffset = -255;
objClip.colorTrans.greenOffset = -255;
objClip.colorTrans.redOffset = -255;
objClip.trans = new flash.geom.Transform(objClip);
objClip.trans.colorTransform = objClip.colorTrans;
objClip._visible = true;
objClip.onEnterFrame = function ()
{
this.colorTrans.blueOffset = this.colorTrans.blueOffset + 20;
this.colorTrans.greenOffset = this.colorTrans.greenOffset + 20;
this.colorTrans.redOffset = this.colorTrans.redOffset + 20;
if (this.colorTrans.blueOffset >= 0 && this.colorTrans.greenOffset >= 0 && this.colorTrans.redOffset >= 0)
{
this.colorTrans.blueOffset = 0;
this.colorTrans.greenOffset = 0;
this.colorTrans.redOffset = 0;
this.trans.colorTransform = this.colorTrans;
this.onEnterFrame = null;
}
else
{
this.trans.colorTransform = this.colorTrans;
} // end else if
};
} // End of the function
arrButtonLabels = new Array("milan<br />2007", "regular<br />site", "");
arrButtonHrefs = new Array("", "http://www.marcelwanders.com/insyde/xml/flash.shtml", "");
set_buttons();
intImageY = 75;
intScreenWidth = 1000;
intSlideWidth = 1000;
intNavLength = 7;
arrLoadedImages = new Array();
blnBufferLoaded = false;
load_images();
stop ();


XML2Object.as file
class XML2Object
{
var _result, _xml, __get__xml, __set__xml;
static var xml2object;
function XML2Object()
{
_result = new Object();
} // End of the function
static function deserialize(xml)
{
xml2object = new XML2Object();
XML2Object.xml2object.__set__xml(xml);
return (XML2Object.xml2object.nodesToProperties());
} // End of the function
function get xml()
{
return (_xml);
} // End of the function
function set xml(xml)
{
_xml = xml;
//return (this.xml());
null;
} // End of the function
function nodesToProperties(parent, path, name, position)
{
var _loc7;
var _loc2;
path == undefined ? (path = _result, _result) : (path = path[name], path);
if (parent == undefined)
{
parent = (XMLNode)(_xml);
} // end if
if (parent.hasChildNodes())
{
_loc7 = parent.childNodes;
if (position != undefined)
{
path = path[position];
} // end if
while (_loc7.length > 0)
{
_loc2 = (XMLNode)(_loc7.shift());
if (_loc2.nodeName != undefined)
{
var _loc4 = new Object();
_loc4.attributes = _loc2.attributes;
_loc4.data = this.sanitizeLineBreaks(_loc2.firstChild.nodeValue );
if (path[_loc2.nodeName] != undefined)
{
if (path[_loc2.nodeName].__proto__ == Array.prototype)
{
path[_loc2.nodeName].push(_loc4);
}
else
{
var _loc6 = path[_loc2.nodeName];
delete path[_loc2.nodeName];
path[_loc2.nodeName] = new Array();
path[_loc2.nodeName].push(_loc6);
path[_loc2.nodeName].push(_loc4);
} // end else if
position = path[_loc2.nodeName].length - 1;
}
else
{
path[_loc2.nodeName] = _loc4;
position = undefined;
} // end else if
name = _loc2.nodeName;
} // end if
if (_loc2.hasChildNodes())
{
this.nodesToProperties(_loc2, path, name, position);
} // end if
} // end while
} // end if
return (_result);
} // End of the function
function sanitizeLineBreaks(raw)
{
if (raw.indexOf("\r\n") > -1)
{
return (raw.split("\r\n").join("\n"));
} // end if
return (raw);
} // End of the function
} // End of Class

can someone find erro in this script
  #3  
Old 06-20-2007, 08:19 PM
umar umar is offline
Registered User
 
Join Date: Jun 2007
Posts: 3
Rep Power: 0
umar is on a distinguished road
contt......

the main problem lies in .as action script file which i am sending with this post ....... please please someone help me its urgent .........
Attached Files
File Type: as XML2Object.as (3.0 KB, 1 views)
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Modifying Action Script 2 macrat1010 Newbies 1 03-08-2011 07:40 AM
NEED HELP - Action Script 2.0 and CS3 timeline questions snake_eyes_wolf Newbies 5 12-17-2007 09:42 PM
Scanning a .fla file for Action Script ? Ultra Flash 8 1 06-23-2007 02:05 PM
Action script in Flash 2004 younger90 Flash MX 2004 0 03-31-2005 09:17 PM
assigning action script to not-yet-used MC debonaireFlash Flash MX ActionScript 5 06-22-2002 03:01 AM




All times are GMT. The time now is 07:54 AM.