Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing a swf through a movie clip

Status
Not open for further replies.

Caden

Programmer
Dec 9, 2001
101
0
0
CA
Hello all, i'm having trouble being able to lock onto the information inside the external.swf file which is being brought in through a movie clip in the main.swf file.

This is in reference to actionscript. If I try to use _root.movieholder, all I seem to get is the main file.

So that is my question, what is the syntax for getting to the external.swf from the main.swf when it is being brought in through a movie clip?
 
To target the loaded movie...
_root.movie_clip_holder.gotoAndPlay("frame_label");

To retreive a variable from it...

my_main_var = _root.movie_clip_holder.my_var;

Regards,

cubalibre2.gif
 
it isn't targeting the movie clip that is the problem, but it seems when I target the movie clip, it doesn't act like there is anything imported into it which makes the movie clip empty
 
maybe this will help

movieclipToLoad = _root.movieholder

loadPercent = (Math.floor (movieclipToLoad.getBytesLoaded() / movieclipToLoad.getBytesTotal() * 100) + "%");
loadBytes = (Math.round((movieclipToLoad.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((movieclipToLoad.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded.");

if (_root.movieholder.getBytesLoaded() == _root.movieholder.getBytesTotal()){ //Check for finished loading
//If loaded, final update to fields
loadPercent = "100%";
loadBytes = (Math.round((movieclipToLoad.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((movieclipToLoad.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded.");

loadbar._xscale = Number(loadpercent);

gotoAndPlay(5); //Where to go once your movie is loaded
}

that's the preloader
 
Are you actually loading some external .swf in this _root.movieholder before using this preloader? Otherwise you're only reading the loaded bytes of the empty movieholder itself which is like 4 bytes.

Regards,

cubalibre2.gif
 
ok, so I'm having the same problems here...

I have a series of external .swfs that I want to "preload" into a container on the stage. I have an array of these files, and want to load 01 after 00 gets entirely loaded etc... I can't seem to acces .getBytesTotal() of the clip as I'm loading it (in order to determine if 00 is totally loaded), it only reads the 4 bytes of the empty container

here's my code (bear with all the traces, still trying to figure out what's up)

function preLoad() {
trace( "Begin loading..." );
for( i = 0; i < _root.maxElements; i++ ) {
trace( &quot;external file bytes: &quot; + _root.movieClipArray [ i ].getBytesTotal());
trace( &quot; Begin loading &quot; + _root.movieClipArray [ i ] + &quot; (&quot; + _root.prjPreLoad.getBytesTotal() + &quot; bytes)&quot; );
loadMovie (_root.movieClipArray [ i ], _root.prjPreLoad )

for( j = _root.prjPreLoad._currentframe; j > 0; ) {
j = _root.prjPreLoad._totalframes - _root.prjPreLoad._currentframe;

trace( &quot; totalframes: &quot; + _root.prjPreLoad._totalframes) ;
if( j == 0 ) {
trace( &quot; project &quot; + _root.movieClipArray [ i ] + &quot; has loaded (&quot; + _root.prjPreLoad.getBytesLoaded() + &quot; bytes)&quot; );
}
}
}
}

any thoughts?

thanks
bugg
 
sorry, that code was incorrect (tryin somethin new...) the correct code is:

function preLoad() {
trace( &quot;Begin loading...&quot; );
for( i = 0; i < _root.maxElements; i++ ) {
loadMovie (_root.movieClipArray [ i ], _root.prjPreLoad )
trace( &quot; Begin loading &quot; + _root.movieClipArray [ i ] + &quot; (&quot; + _root.prjPreLoad.getBytesTotal() + &quot; bytes)&quot; );
trace( &quot;BytesTotal: &quot; + _root.prjPreLoad.getBytesTotal() );
for( j = _root.prjPreLoad.getBytesTotal(); j > 0; ) {
j = _root.prjPreLoad.getBytesTotal() - _root.prjPreLoad.getBytesLoaded;

if( j == 0 ) {
trace( &quot; project &quot; + _root.movieClipArray [ i ] + &quot; has loaded (&quot; + _root.prjPreLoad.getBytesLoaded() + &quot; bytes)&quot; );
}
}

}
trace( &quot;End loading.&quot; );
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top