View Full Version : loading dynamically created movie into another
Zanne
07-12-2005, 06:49 PM
I've dynamically created (stage is has only background image) a movie that contains buttons, volume slider, etc... This movie publishes superbly. Have tried to load .swf into another movie using loadMovieNum, but all that loads is the background, but none of the dynamically created items.
Is there an obvious reason for this? Thanks
I would check your paths for all your dynamically created content. If you load it into another swf, the _root becomes the incorrect path.
Zanne
08-04-2005, 07:35 PM
There are no _root references in the code, and have tried adding "this" but it still does not work. The closest I got was to redefine _global variables as regular variables and got some of the dynamic content to show, but most does not. What is ignored includes script within movie clips and attaching sounds.
Paerez
08-04-2005, 08:40 PM
I would suggest using attachMovie, not loadMovieNum. With attachMovie you can load a swf into a movie clip on the stage, instead of using levels like loadMovieNum does. It keeps everything on the same timeline.
Also, throw in a couple trace(this); statements if you are unsure of your scope.
In the past, I have found that things like
trace(this._parent);
trace(_parent);
actually can output different things!
read my signature below :D
Zanne
08-05-2005, 05:34 PM
The mechanism to load the .swf is not loadMovieNum, but MovieClipLoader() along with loadClip. I've tried adding "this", "_parent", and this._lockroot=true;
I have made headway, however, by removing a line of code (onLoad=function(){}) from the external movie and everything works fine, except the sounds. Here is the external .swf code. Any ideas?
// constants
_global.ROWS = 4;
_global.COLUMNS = 5;
_global.BOXWIDTH = 100;
_global.BOXHEIGHT = 40;
_global.DEFAULTBOXALPHA = 30;
_global.SPEED = 5;
// variables
var x, y:Number = 0;
var soundNum:Number=0;
// pg 43, 4
// grid development
this.createEmptyMovieClip("movieGrid", 1);
// set initial volume
movieGrid.soundVolume = 100;
movieGrid.gridColumnCount = 0;
// attaching the individual cells of the grid
// setting the height and width
for (x=0; x<ROWS; x++) {
for (y=0; y<COLUMNS; y++) {
var boxName:String = "boxMC"+x+"_"+y;
movieGrid.attachMovie("boxMC", boxName, 10*x+y);
movieGrid[boxName]._width = BOXWIDTH;
movieGrid[boxName]._height = BOXHEIGHT;
movieGrid[boxName]._x = movieGrid[boxName]._width*y;
movieGrid[boxName]._y = movieGrid[boxName]._height*x;
movieGrid[boxName].boxLight._alpha = DEFAULTBOXALPHA;
// pg45, 8
// attaching sounds
movieGrid[boxName].sound = new Sound();
movieGrid[boxName].soundNum = soundNum;
movieGrid[boxName].sound.attachSound("sound"+soundNum);
soundNum++;
}
}
// Building the playhead and placing it on the stage
movieGrid.attachMovie("playHead", "playHead", 10000);
movieGrid.playHead.bar._height = movieGrid._height;
movieGrid.playHead.knob._y = movieGrid._height;
movieGrid.playHead._x -= BOXWIDTH/COLUMNS;
// building and positioning the button
movieGrid.attachMovie("playButton", "playButton", 20000);
movieGrid.playButton._x = movieGrid._width-(BOXWIDTH+movieGrid.playButton._width/2);
movieGrid.playButton._y = movieGrid._height+BOXHEIGHT;
// build and position volume slider
movieGrid.attachMovie("volumeSlider", "volumeSlider", 30000);
movieGrid.volumeSlider._x = BOXWIDTH-(BOXWIDTH/COLUMNS)/COLUMNS;
movieGrid.volumeSlider._y -= BOXHEIGHT/2;
// position all attached elements
movieGrid._x = ((Stage.width/2)-(movieGrid._width/2))+(BOXWIDTH/COLUMNS)/COLUMNS;
movieGrid._y = ((Stage.height/2)-(movieGrid._height/2))+BOXHEIGHT/2;
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.