-
just a newbie with a simple question
here's my code
_root.createEmptyMovieClip("holder", 0);
_root.holder.loadMovie("region.swf","newRegion", 0);
_root.holder.onEnterFrame = function() {
if(this.getBytesLoaded() == this.getBytesTotal) {
_root.holder.newRegion.ottawa.onRelease = function() {
trace("ontario pressed");
}
}
}
The movie ("region.swf") I'm loading has a movieClip(ottawa) in it, and I want the clip to react when being pressed by tracing a message. I have no problem doing this if I were to attach this movie, instead of loading it dynamically. Region has no problem loading, but then nothing, I get more interactivity from loading a jpeg.
Summed up -> How do I get a movieclip/button inside a loaded movie to react like any other movieclip?
thanks
-
hi traden,
ok, first i'm guessing there is residual code left over from an attach movie with this:
_root.holder.loadMovie("region.swf","newRegion", 0);
now the only way i have been able to get around this is by pausing for a half second or so after the loadMovie command, it seems like an awfully big workaround and there may be other ways of doing this but, If you trace getBytesLoaded it initially returns 0 so by pausing for a second, barely noticeable mainly by you, we can then grab the total bytes of the swf that needs to be loaded. Example:
Code:
_root.createEmptyMovieClip("holder", 0);
holder.loadMovie("region.swf");
callInterval(.5); //set the interval for the 1/2 second wait below
function callInterval(num){
intervalID = setInterval(callback, (num*1000)); //1/2 second is up call the callback func
}
function callback() {
clearInterval(intervalID); //clear the interval as to not run continuously
checkStatus();
}
function checkStatus(){ //now check status
total = holder.getBytesTotal();
holder.onEnterFrame=function(){
down = holder.getBytesLoaded();
if(down==total){
setProps();
delete holder.onEnterFrame;
}
}
}
function setProps(){ //set your properties here
holder.ottawa.onRelease=function(){
trace("STUFF");
}
}
stop();
Hope this helps some,
Dunc
-
Hey thanks a lot...seems like a strange work around, but it seems to work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|