Docunext

  • About

Actionscript loadMovie Notes

In actionscript, you cannot reference a movie until it is loaded. Code to work around that (for loadmovienum):

function preloadLevel() {    if (_level5 != undefined) {        trace("level 5 loaded");        delete this.onEnterFrame;    }}_root.onEnterFrame = preloadLevel;

loadMovieNum("external.swf", 5); // load something into level 5

Code for XML:// Create new XML object

SP_XML = new XML();

SPXML.ignoreWhite = true;// load the XML data - the gate will take care of the// locationid, all that jazz.//SP_XML.load("/acc/link/loc/view/sp/xml/");

SPXML.load("/main/swf/samplespaceplan.xml");// Render the space plan - load the SWF movies and// arrange them as necessary.//SPXML.onLoad = renderSpacePlan;

SPXML.onLoad = function(success:Boolean) { if (success) { spaceplanid = this.firstChild.attributes.id; trace("id"+spaceplanid); // Set array SpEquipment to the equipment arrays. SpEquipment = this.firstChild.childNodes; //loadMovieNum("/acc/link/loc/spserver/&locationspaceplanid="+spaceplanid, 0); //loadMovieNum("/acc/link/types/symbolserver/&equipmenttypesymbolid=3",2); for (var i = 0; i<SpEquipment.length; i++) { assetx = SpEquipment[i].attributes.x; assety = SpEquipment[i].attributes.y; assettypeid = SpEquipment[i].attributes.assettype; j=i+2; //root.createEmptyMovieClip("eqp"+j, j); _root.eqp.duplicateMovieClip("eqp"+j, j); _root["eqp"+j].onClic root["eqp"+j].x = assetx; _root["eqp"+j].y = assety; _root["eqp"+j].loadMovie("/acc/link/types/symbolserver/&equipmenttypesymbolid=" + assettypeid); //root["eqp"+j].loadMovie("/main/swf/kiosk.swf"); } } else { trace("xml failed to load."); }};root.eqp.onLoad = function(success:Boolean) { if (success) { duplicateMovieClip(root.eqp, "eqp2", 3); root.eqp2.x = 65; }};// this sucks

function preloadLevel() { //Assuming a loop needs to be run here to evaluate each level load status! //Definitely want a "Now constructing the space plan... please stand by screen." if (level2 != undefined) { _level2.x = 150; level2.y = 125; level2.rotation = 45; newclip = duplicateMovieClip(level2, blah, 33); newclip.x = 45; delete this.onEnterFrame; }}_root.onEnterFrame = preloadLevel;

Yearly Indexes: 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2015 2018 2019