1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
| function loader_updateLoadingBar()
{
_root.loading_animation_mc._rotation = _root.loading_animation_mc._rotation + 30;
} // End of the function
function loader_animation_start()
{
loading_animation_mc.clear();
loading_animation_mc._alpha = 100;
loader_loadingalpha = 100;
for (var _loc2 = 0; _loc2 < 12; ++_loc2)
{
var _loc3 = loader_loadingangle / 180 * 3.141593;
dx = -Math.cos(_loc3) * 22.500000;
dy = Math.sin(_loc3) * 22.500000;
loading_animation_mc.drawdots(dx, dy, 5, 13421772, loader_loadingalpha);
loader_loadingangle = loader_loadingangle + 30;
loader_loadingalpha = loader_loadingalpha - 7;
} // end of for
_root.createTextField("LoadingText", _root.getNextHighestDepth(), Stage.width / 2 - 14, Stage.height / 2 - 9, 28, 20);
_root.LoadingText.html = true;
_root.LoadingText.multiline = true;
_root.LoadingText.selectable = false;
_root.LoadingText.htmlText = "<font size=\"10\" face=\"Arial\">iMap</font>";
loading_animation_mc._x = Number(Stage.width / 2);
loading_animation_mc._y = Number(Stage.height / 2);
loader_interval = setInterval(loader_updateLoadingBar, 85);
} // End of the function
function loader_animation_clear()
{
clearInterval(loader_interval);
loading_animation_mc.clear();
} // End of the function
function main()
{
preload();
} // End of the function
function preload()
{
onEnterFrame = function ()
{
if (getBytesLoaded() >= getBytesTotal())
{
delete onEnterFrame;
powerOn();
} // end if
};
} // End of the function
function powerOn()
{
Stage.align = "TL";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
createEmptyMovieClip("loading_animation_mc", getNextHighestDepth());
loader_animation_start();
consoleStart();
keyListenerStart();
stageListenerStart();
systemStart();
} // End of the function
function systemStart()
{
demo_mc._visible = false;
demo_btn._visible = false;
consoleTrace("[notice] System Start");
if (datasource != undefined)
{
xmldata_xml = new XML();
xmldata_xml.ignoreWhite = true;
xmldata_xml.onLoad = function (success)
{
clearInterval(intervalDatasource);
if (success)
{
if (this.status == 0)
{
consoleTrace("[notice] Loaded " + datasource);
loadMap();
}
else
{
consoleTrace("[error] " + xml_error2string(this.status) + " in " + datasource);
} // end else if
}
else
{
consoleTrace("[error] Unable to load " + datasource + ", file may be missing.");
} // end else if
};
consoleTrace("[notice] Loading " + datasource);
intervalDatasource = setInterval(progressDatasource, 1000);
xmldata_xml.load(datasource);
}
else
{
consoleTrace("[error] The parameter \"datasource\" is missing, please check the Flash <object> tags in HTML source file.");
} // end else if
} // End of the function
function loadMap()
{
consoleTrace("[notice] Loading Map File");
map_mc.removeMovieClip();
createEmptyMovieClip("map_mc", getNextHighestDepth());
var _loc2 = new MovieClipLoader();
var _loc1 = new Object();
_loc1.onLoadError = function (target, errorCode, httpStatus)
{
consoleTrace("[error] Unable to load Map File, " + errorCode + ". HTTP " + httpStatus);
};
_loc1.onLoadInit = function ()
{
consoleTrace("[notice] Loaded Map File");
demo_mc._x = (Stage.width - 329.200000) / 2;
demo_mc._y = (Stage.height - 197.400000) / 2;
loadModule();
};
_loc2.addListener(_loc1);
_loc2.loadClip(mx.xpath.XPathAPI.selectSingleNode(xmldata_xml.firstChild, "/flashimap").attributes.src, map_mc);
} // End of the function
function loadModule()
{
consoleTrace("[notice] Loading Standard Module");
standard_mc.removeMovieClip();
createEmptyMovieClip(mx.xpath.XPathAPI.selectSingleNode(xmldata_xml.firstChild, "/flashimap/module").attributes.id + "_mc", getNextHighestDepth());
var _loc2 = new MovieClipLoader();
var _loc1 = new Object();
_loc1.onLoadError = function (target, errorCode, httpStatus)
{
consoleTrace("[error] Unable to load Standard Module, " + errorCode + ". HTTP " + httpStatus);
};
_loc1.onLoadInit = function ()
{
consoleTrace("[notice] Loaded Standard Module");
clearInterval(loader_interval);
};
_loc2.addListener(_loc1);
_loc2.loadClip(mx.xpath.XPathAPI.selectSingleNode(xmldata_xml.firstChild, "/flashimap/module").attributes.src, mx.xpath.XPathAPI.selectSingleNode(xmldata_xml.firstChild, "/flashimap/module").attributes.id + "_mc");
} // End of the function
function progressDatasource()
{
consoleTrace("[notice] Loading " + datasource + " " + Math.round(xmldata_xml.getBytesLoaded() / xmldata_xml.getBytesTotal() * 100) + "%");
} // End of the function
function loadingbarOn(text)
{
} // End of the function
function loadingbarProgress(now, total)
{
} // End of the function
function loadingbarOff()
{
} // End of the function
function consoleStart()
{
createEmptyMovieClip("transparent_mc", getNextHighestDepth());
drawRectangleFill(transparent_mc, Stage.width, Stage.height, 0, 0, 0, 0);
createEmptyMovieClip("console_mc", getNextHighestDepth());
console_mc._visible = false;
console_mc.createEmptyMovieClip("bg_mc", console_mc.getNextHighestDepth());
drawRectangleFill(console_mc.bg_mc, Stage.width, Stage.height, 0, 0, 8806, 75);
console_mc.createTextField("trace_txt", getNextHighestDepth(), 0, 0, Stage.width, Stage.height);
console_mc.trace_txt.html = true;
console_mc.trace_txt.htmlText = "<font face=\"Tahoma\" size=\"11\" color=\"#FFFFFF\">flashimap Console";
console_mc.trace_txt.mouseWheelEnabled = true;
console_mc.trace_txt.multiline = true;
console_mc.trace_txt.selectable = true;
} // End of the function
function consoleToggle()
{
consoleResize();
createEmptyMovieClip("highest_mc", getNextHighestDepth());
console_mc.swapDepths(highest_mc);
highest_mc.removeMovieClip();
if (console_mc._visible == false)
{
console_mc._visible = true;
}
else
{
console_mc._visible = false;
} // end else if
} // End of the function
function consoleResize()
{
console_mc.trace_txt._height = Stage.height;
console_mc.trace_txt._width = Stage.width;
console_mc.bg_mc._height = Stage.height;
console_mc.bg_mc._width = Stage.width;
transparent_mc._height = Stage.height;
transparent_mc._width = Stage.width;
} // End of the function
function consoleTrace(txt)
{
var _loc1 = new Date();
console_mc.trace_txt.htmlText = console_mc.trace_txt.htmlText + ("[" + timeStamp() + "] " + txt + "\n");
console_mc.trace_txt.scroll = console_mc.trace_txt.maxscroll;
} // End of the function
function drawRectangleFill(obj, w, h, x, y, color, alpha)
{
obj.beginFill(color, alpha);
obj.moveTo(x, y);
obj.lineTo(x + w, y);
obj.lineTo(x + w, y + h);
obj.lineTo(x, y + h);
obj.lineTo(x, y);
obj.endFill();
} // End of the function
function keyListenerStart()
{
keyListener = {};
keyListener.onKeyDown = keyListenerOnKeyDown;
Key.addListener(keyListener);
} // End of the function
function keyListenerStop()
{
Key.removeListener(keyListener);
delete keyListener;
} // End of the function
function keyListenerOnKeyDown()
{
key = Key.getAscii();
if (key == 96)
{
consoleToggle();
} // end if
if (key == 27)
{
clearInterval(intervalDatasource);
keyListenerStop();
} // end if
} // End of the function
function stageListenerStart()
{
stageListener = {};
stageListener.onResize = stageListenerOnResize;
Stage.addListener(stageListener);
} // End of the function
function stageListenerOnResize()
{
consoleTrace("[notice] Stage size changed to " + Stage.width + "x" + Stage.height);
consoleResize();
} // End of the function
function timeStamp()
{
var _loc1 = new Date();
var _loc7 = _loc1.getFullYear().toString();
var _loc4 = (1 + _loc1.getMonth()).toString();
if (_loc4.length == 1)
{
_loc4 = "0" + _loc4;
} // end if
var _loc2 = _loc1.getDate().toString();
if (_loc2.length == 1)
{
_loc2 = "0" + _loc2;
} // end if
var _loc5 = _loc1.getHours().toString();
if (_loc5.length == 1)
{
_loc5 = "0" + _loc5;
} // end if
var _loc6 = _loc1.getMinutes().toString();
if (_loc6.length == 1)
{
_loc6 = "0" + _loc6;
} // end if
var _loc3 = _loc1.getSeconds().toString();
if (_loc3.length == 1)
{
_loc3 = "0" + _loc3;
} // end if
return (_loc7 + "-" + _loc4 + "-" + _loc2 + " " + _loc5 + ":" + _loc6 + ":" + _loc3);
} // End of the function
function xml_error2string(code)
{
switch (code)
{
case 0:
{
errorMessage = "No error; parse was completed successfully";
break;
}
case -2:
{
errorMessage = "A CDATA section was not properly terminated";
break;
}
case -3:
{
errorMessage = "The XML declaration was not properly terminated";
break;
}
case -4:
{
errorMessage = "The DOCTYPE declaration was not properly terminated";
break;
}
case -5:
{
errorMessage = "A comment was not properly terminated";
break;
}
case -6:
{
errorMessage = "An XML element was malformed";
break;
}
case -7:
{
errorMessage = "Out of memory";
break;
}
case -8:
{
errorMessage = "An attribute value was not properly terminated";
break;
}
case -9:
{
errorMessage = "A start-tag was not matched with an end-tag";
break;
}
case -10:
{
errorMessage = "An end-tag was encountered without a matching start-tag";
break;
}
default:
{
errorMessage = "An unknown error has occurred";
break;
}
} // End of switch
return (errorMessage);
} // End of the function
function bringToFront()
{
} // End of the function
if (datasource == undefined)
{
datasource = "data/project.xml";
} // end if
var loader_loadingalpha = 0;
var loader_loadingangle = 0;
var loader_interval;
var backhome = new Array();
MovieClip.prototype.drawdots = function (dotscenterx, dotscentery, dotsradius, dotscolor, dotsalpha)
{
var _loc4 = 0.785398;
var _loc5 = dotsradius / Math.cos(_loc4 / 2);
this.moveTo(dotscenterx + dotsradius, dotscentery);
this.beginFill(dotscolor, dotsalpha);
var _loc2 = 0;
for (var _loc3 = 0; _loc3 < 8; ++_loc3)
{
_loc2 = _loc2 + _loc4;
angleMid = _loc2 - _loc4 / 2;
cx = dotscenterx + Math.cos(angleMid) * _loc5;
cy = dotscentery + Math.sin(angleMid) * _loc5;
px = dotscenterx + Math.cos(_loc2) * dotsradius;
py = dotscentery + Math.sin(_loc2) * dotsradius;
this.curveTo(cx, cy, px, py);
} // end of for
this.endFill();
};
stop ();
main(); |
Partager