Question
Preloader not working in externaly loaded swf (HELP!)
Hi.
I have posted this before but could not get the method suggested to work.
I have an swf ("myCarMovie") that opens within an empty movie clip ("picHolder") that is on the main timeline of my movie. "myCarMovie" is triggered from a button on a thumbnailer that opens it within "picHolder". All works well until I add the preloader that features a progress bar and percentage loaded.
I have placed the progress bar at the start of "myCarMovie". When I test "myCarMovie" on its own it is fine but not when I publish and run the whole movie. What happens is that it shows just the loadbar graphic at 100% length and does not move to frame 2. It is stuck on the loadbar graphic.
Obviously I started looking at _root in the script.
I have included the script for the preloader below if anybody wants to make a suggestion and give me a cure!!
Thanks
onClipEvent (load) {
var origW = _root.loadbar._width;
var newW = _root.loadbar._width;
var moveX = _root.loadbar._x-(_root.loadbar._width/2);
}
onClipEvent (enterFrame) {
_root.percent = int((_root.getBytesLoaded()/_root.getBytesTotal())*100);
_root.txtPercent = _root.percent+"%";
_root.loadbar._width = Number(_root.percent);
_root.loadbar._x = moveX+_root.loadbar._width/2;
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
_root.gotoAndPlay(2);
}
}
I have posted this before but could not get the method suggested to work.
I have an swf ("myCarMovie") that opens within an empty movie clip ("picHolder") that is on the main timeline of my movie. "myCarMovie" is triggered from a button on a thumbnailer that opens it within "picHolder". All works well until I add the preloader that features a progress bar and percentage loaded.
I have placed the progress bar at the start of "myCarMovie". When I test "myCarMovie" on its own it is fine but not when I publish and run the whole movie. What happens is that it shows just the loadbar graphic at 100% length and does not move to frame 2. It is stuck on the loadbar graphic.
Obviously I started looking at _root in the script.
I have included the script for the preloader below if anybody wants to make a suggestion and give me a cure!!
Thanks
onClipEvent (load) {
var origW = _root.loadbar._width;
var newW = _root.loadbar._width;
var moveX = _root.loadbar._x-(_root.loadbar._width/2);
}
onClipEvent (enterFrame) {
_root.percent = int((_root.getBytesLoaded()/_root.getBytesTotal())*100);
_root.txtPercent = _root.percent+"%";
_root.loadbar._width = Number(_root.percent);
_root.loadbar._x = moveX+_root.loadbar._width/2;
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
_root.gotoAndPlay(2);
}
}