I have two swf files. I am trying to load a myMovie.swf gotoAndStop(2) and set a movieclip on frame 2 named ‘myNum’ to alpha=.2
It seems the movieclip ‘myNum’ is recognized as a child, it is just that I can’t change any of that childs properties.
I am using a loader object and I can tell it to goto a frame that I want.
does anyone know how to change the alpha property of myNum?
loaderMC.swf and myMovie.swf
in loaderMC.swf
I have one keyframe
on frame 1, I have this code:
////////////////////////////////////////////////////////////////////////
//////////////////////make container for loader/////////////////////
////////////////////////////////////////////////////////////////////////
//
//create container for the loader
var box:MovieClip = new MovieClip();
box.name='box';
addChild(box);
//
/////////////////////////////////////////////////////////////////////////
///////////////////////make loader object////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
//create loader
var contentInitializeLoader:Loader = new Loader();
contentInitializeLoader.name='containerMC';
//add loader to box
box.addChild(contentInitializeLoader);
//
/////////////////////////////////////////////////////////////////////////
/////////////////////////file to load////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
var urlString='myMovie.swf';
//
/////////////////////////////////////////////////////////////////////////
///////////////////////Listener for loader///////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
//create listener for loader that will call a function when load is completed
contentInitializeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentInitializeLoaded);
//load desired file from the var defined above
contentInitializeLoader.load(new URLRequest(urlString));
trace('loading ('+urlString+')');
//
/////////////////////////////////////////////////////////////////////////
///////////////////////Load Listener Function////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
//this function waits until contentInitializeLoader sends Event.COMPLETE.
function contentInitializeLoaded(e:Event):void {
//////////////////////////
//on Event.COMPLETE make instance of loader for targeting as a MovieClip()
var theMC=box.getChildAt(0);
//////////////////////////
//when targeting as a MovieClip(theMC.content) you can request the oject to perform movieClip duties
//////////////////////////
//theMC.gotoAndStop(2);//doesn't work because (theMC) is being referenced as its original object type, a loader object
//////////////////////////
/*but the following does*/
//////////////////////////
//// this is my issue ////
MovieClip(theMC.content).gotoAndStop(2);// myNum is the instance name of a movieclip which exsists on keyframe 2 of myMovie.swf
trace(MovieClip(theMC.content).numChildren);//traces a number indicating that myNum has been instantiated
for (var childNumber:int=0; childNumber<MovieClip(theMC.content).numChildren; childNumber++) {
trace(MovieClip(theMC.content).getChildAt(childNumber));//myNum should trace here but traces null instead
}
if(MovieClip(theMC.content).getChildByName('myNum') != null){
trace('its here');
MovieClip(theMC.content).getChildByName('myNum').alpha=.2;
}
//////////////////////////
MovieClip(theMC.content).x=(stage.stageWidth / 2)-(MovieClip(theMC.content).width/2);
MovieClip(theMC.content).y=(stage.stageHeight / 2)-(MovieClip(theMC.content).height/2);
//////////////////////////
//////////////////////////
}
/////////////////////////////////////////////////////////////////////////
in the second file
myMovie.swf I have 2 keyframes.
keyframe 1 has a stop action.
keyframe 2 has a movieclip placed on the stage with the name of ‘myNum’
Thanks,
Aubrey