all groups > flash actionscript > january 2007 >
You're in the

flash actionscript

group:

time based quirk


time based quirk jagguy99
1/18/2007 11:22:56 PM
flash actionscript:
Hi,
In a time base function if load a MC it fails to be clickable (but the MC
appears). If I load it outside the time base function it works fine and is
clickable.

I don't get this ? I spent ages trying to find out why it fails and it comes
down to a time based quirk it seems. is there anything I can do ?


var aval:Array= new Array();
aval.push("98img1.jpg");
aval.push("50img2.jpg");

function createShifters():Void{
this.attachMovie("move1","mc4",this.getNextHighest Depth());
mc4._x=300;
mc4._y=200;
}

function main():Void
{
if (aval.length>0)
{
// createShifters(); failed
clearInterval(timeINum);
createShifters(); //fails to be clickable but loads the image
}
}

var timeINum:Number=setInterval(main,1000);
createShifters(); //works outside of the time limit


mc4.onPress = function () :Void
{
...
}
Re: time based quirk kglad
1/19/2007 12:18:50 AM
you can't define your onPress handler for mc4 BEFORE mc4 exists and expect it to work.

Re: time based quirk jagguy99
1/19/2007 1:38:37 AM
Ok i found this out aftyer i posted as well.
Re: time based quirk kglad
1/19/2007 3:05:01 AM
it doesn't get any easier than swapDepths() and it's the only way to control
the depth using actionscript.

in the authoring environment you can use layers to control the apparent depth
of objects (and flash converts assigns the object depths in accord with your
layers).
AddThis Social Bookmark Button