I have a site that works off full screen flash.
I am having a problem where after the preloader and the site animates in the site disappears the first time, but when you hit "refresh" it animates the site in, then it stays.
Also the site seems rather choppy the first time, then after going through the pages and refreshing they play smooth. I am starting to think my preloader isnt "preloading"
Below is my full screen code.
ActionScript Code:
Stage.scaleMode = "noscale";
Stage.align = "tl";
Stage.addListener({onResize:reposition});
function reposition() {
var bg = _root.bg_mc;
var tour = _root.tour_mc;
var nPos;
nPos = getNewPosition(bg);
bg._x = nPos.x;
bg._y = nPos.y;
nPos = getNewPosition(tour);
tour._x = nPos.x;
tour._y = nPos.y;
};
function getNewPosition(mc) {
var newX = Math.floor((Stage.width - mc._width) / 2);
var newY = Math.floor((Stage.height - mc._height) / 2);
return {x:newX, y:newY};
};
reposition();
stop();
Now my preload code.
ActionScript Code:
onClipEvent (load) {
if (_root.getBytesTotal() == _root.getBytesLoaded()) {
quickPlay = true;
} else {
preLoad = (_root.getBytesTotal() * 0.95); //percent to preload
}
_root.stop();
}
onClipEvent (enterFrame) {
gotoAndStop(loadedIndicatorFrame());
if (quickPlay == true) { //quickly play the anim
if (_currentframe == _totalframes) {
_root.gotoAndPlay("project");
}
} else { //wait for the preload
if (_root.getBytesLoaded() >= preLoad) {
_root.gotoAndPlay("project");
}
}
}
This is the code inside the preloader.
ActionScript Code:
lastFrame = 1;
function loadedIndicatorFrame() {
var newFrame = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 65) + 2;
if (newFrame - lastFrame > 4) { //too far
lastFrame += 4;
loadedText = int(_root.getBytesTotal() / 1024 * (lastFrame - 2) / 65) + "kb of " + int(_root.getBytesTotal() / 1024) + "kb";
} else if (newFrame - lastFrame > 0) { //normal move
lastFrame++;
loadedText = int(_root.getBytesLoaded() / 1024) + "kb of " + int(_root.getBytesTotal() / 1024) + "kb";
} else { //update the text only
loadedText = int(_root.getBytesLoaded() / 1024) + "kb of " + int(_root.getBytesTotal() / 1024) + "kb";
}
return lastFrame;
}
I have used these three sets of code before trouble free, so I am lost why this is a problem now.
Any help would be great.
-- Nate
..:: www.ne-media.com ::..