all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Doesn't work when loaded


Doesn't work when loaded thejokerman05
10/14/2006 10:35:19 PM
flash actionscript:
I have a main movie where I'm loading .swfs into using MCL. When this .swf is
loaded it just don't work. Any idea on this? Here's the code and
http://www.gregory.se/example.fla if anyone is up to it.



// how many nav buttons
var picNum:Number = 5;

// start
containerMC._alpha = 0;
btn1.alphaTo(100, .5)
btn1.enabled = false;

// navigation
for (var i = 1; i<=picNum; i++) {
_root["btn"+i].topText_mc.text = [i];
}

// buttons
function hitButton(nbrID) {
btn = _root["btn"+nbrID];
btn.nbrID = nbrID;
btn.onRollOver = function() {
this.alphaTo(100, .5);
}
btn.onRollOut = function() {
this.alphaTo(30, .5);
}
btn.onRelease = function() {
_root.containerMC.loadPic("images/"+nbrID+".jpg");
btn1._alpha = 30;
btn1.enabled = true;
for (var i = 2; i<15; i++) {
_root["btn"+i]._alpha = 30;
_root["btn"+i].enabled = true;
this._alpha = 100;
this.enabled = false;
}
}
}

for (var i = 1; i<15; i++) {
_root.hitButton(i);
}

// view images
MovieClip.prototype.loadPic = function(pic){
containerMC._alpha = 0;
this.loadMovie(pic);
_root.onEnterFrame = function(){
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
if (t != 0 && Math.round(l/t) == 1&&containerMC._width>0){
var w = containerMC._width + 2, h = containerMC._height + 2;
bg_mc.resizeMe(w, h);
delete _root.onEnterFrame;
}
}
}

MovieClip.prototype.resizeMe = function(w, h) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
if (Math.abs(this._width-w)<1) {
this._width = w;
this._height = h;
containerMC._x = border._x-containerMC._width;
containerMC._y = border._y-containerMC._height/2;
_root.containerMC._alpha += 9;
if (_root.containerMC._alpha>90) {
_root.containerMC._alpha = 100;
delete this.onEnterFrame;
}
}
}
}

containerMC.loadPic ("images/1.jpg");
Re: Doesn't work when loaded thejokerman05
10/15/2006 1:50:02 PM
Solved it! It was as simple as the path to my images was lacking info ;) since it was loading into a main swf.

AddThis Social Bookmark Button