hga77
February 10, 2004, 2:49am
1
This should be easy to answer…
I have 2 swf’s:
Section.swf (to be loaded in main)
Main.swf
In section.swf, on the first frame I have this:
[AS]
onLoad = function(){
// start doing stuff
}[/AS]
When I run the section.swf on its own, the onload function works, and the “doing stuff” code runs. But when I load it into main, this onload (within the section.swf, above) does not run!
I desperately need to fix this. Any help please…thanks
system
February 10, 2004, 2:52am
2
take everything out of onload and just stick it in the timeline.
system
February 10, 2004, 2:55am
3
I did that, the code still wont run!!!
system
February 10, 2004, 3:05am
5
ok…
just look at the onload function on the top…
[AS]
this.onLoad = function() {
/Initialise variables /
stage_width = 512;
stage_height = 384;
var image_Initial_Position_x = -(stage_width/2);
var image_Initial_Position_y = -(stage_height/2);
/***************************/
MovieClip.prototype.useHandCursor = false;
window = this.createEmptyMovieClip(“border”, 2);
border.beginFill (0xFF0000, 100);
border.lineStyle(1, 0, 100);
border.lineTo(stage_width, 0);
border.lineTo(stage_width, stage_height);
border.lineTo(0, stage_height);
border.lineTo(0, 0);
endFill();
setMask(window);
this.createEmptyMovieClip(“clip”,“clip”,1);
clip._x = image_Initial_Position_x;
clip._y = image_Initial_Position_y;
clip.loadMovie(“car original.jpg”);
preload(clip);
};
[/AS]
outside this function (onload) I have proto functions, but that all works fine…
I just need the onload to run when this fla is being loaded into the main.
Thanks
system
February 10, 2004, 3:17am
6
and when I dont include the onload function, the preload(clip) function call doesnt run.
system
February 10, 2004, 10:56am
7
bottom line, onLoad isnt used like that. You would basically only use it with OOP classes associated with movieclips.
where is preload defined?
system
February 10, 2004, 1:44pm
8
thanks senocular …I just changed the onload to a this.onEnterFrame function and it worked…thanks again