0
votes

I am using Flash CS4, AS2.

I have a first SWF, the interface, which loads external SWFs, the pages, through attachMovie. The pages themselves contain clickable buttons. What I am trying to do is enable and disable the buttons on the pages, without altering the code of the pages. I can only change the contents of the interface.

I have tried using a blocker, a movieclip with :

onrelease = function() {};
onpress = function() {};
useHandCursor = false;

This however only prevents clicks within the interface and the external pages seems to still get the mouse events.

Is there a way to enable and disable the pages from getting the clicks? I don't want to stop it's execution (nothing that stop()).

Thank you.

1

1 Answers

0
votes

How about having the loaded content on a specific depth (via MovieClipLoader's loadClip) and a 'blocker' transparent MovieClip on top (getNextHighestDepth()) with an empty press/release handler that you can it's _visible property to false when it's not needed ?

here's a basic example:

var loadedContent:MovieClip = createEmptyMovieClip("loadedContent",getNextHighestDepth());
var loader:MovieClipLoader = new MovieClipLoader();
loader.loadClip("as2loadee.swf",loadedContent);//loads content on _level0, unlike loadMovieNum

var blocker:MovieClip = createEmptyMovieClip("blocker",getNextHighestDepth());
blocker.beginFill(0,0);//transparent fill
drawRect(blocker,0,0,100,100);//these values might change
blocker.endFill();
blocker.onPress = function():Void{
    trace("nuh-uh!");
}

function drawRect(target:MovieClip,x:Number,y:Number,w:Number,h:Number):Void{
    target.lineTo(x  ,y  );
    target.lineTo(x+w,y  );
    target.lineTo(x+w,y+h);
    target.lineTo(x  ,y+h);
    target.lineTo(x  ,y  );
}