Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
443 views
in Technique[技术] by (71.8m points)

actionscript 3 - as3 externally loaded swf from network to control externally loaded swf from network

I have had several posts like this but I have not gotten down to the final answer so I put this image together to try and explain what I am trying to do. I AM SO CLOSE. if you can help me THANK YOU SOOOO MUCH. Worked days on this so far.

HOW DO I CONTROL CHILDREN INSIDE AN EXTERNALLY LOADED SWF FROM CODE IN ANOTHER EXTERNALLY LOADED SWF?

EDIT: Below is THEE code located in "ONE.swf" that I need help with. Just one or two lines I know but I JUST CANT get it.

function FunctionInOne()
{
var parentObj:Object = this.parent.parent as Object; //// GIVES ACCESS TO "Content.swf"
var TheStage:Object = this.parent.parent.parent as Object; //// GIVES ACCESS TO STAGE
trace(TheStage.stage.stageWidth);
trace(parentObj);  ///    [object MainTimeline]
trace(parentObj.ONE); /// [object Loader]
trace(parentObj.TWO); ///  [object Loader]

parentObj.alpha = .3; /// NOW I CONTROL THE ALPHA OF "Content.swf" from ONE.swf
var ControlTWO:Loader = parentObj.TWO; // GIVES ACCES TO LOADER TWO

ControlTWO.alpha = .3; // NOW I CONTROL THE ALPHA OF TWO.swf from ONE.swf


BUT HOW DO I GET ACCESS TO CONTROL THE CHILDREN IN "TWO.swf" from "ONE.swf"


var TWOchildren:MovieClip = MovieClip(TWO.content); // DOES NOT WORK
TWOchildren.ChildInTWO.alpha = .3;


var TWOchildren = TWO.content as MovieClip; // DOES NOT WORK
TWOchildren.ChildInTWO.alpha = .3;  // DOES NOT WORK

TWOchidren.FunctionInTWO(); /// DOES NOT WORK

}

EDIT: March 16th, 2012

I am able to access the swf TWO.swf from ONE.swf and control it's alpha with this line:

trace(MovieClip(parent.parent).ONE); 

But I need to control a child in that so I thought this following code would work but it doesn't:

MovieClip(parent.parent).ONE.TheChild.alpha = .3;

END EDIT---------------

I PUT THIS GRAPHIC TOGETHER TO HELP SHOW WHAT I AM TRYING TO DO. Here is another link to it if you can see it: http://mycontactcorner.com/sandbox/testing/ChildTwo.jpg

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ok I found it!

var InsideConent:Object = this.parent.parent as Object; //// GIVES ACCESS TO "Content.swf"
var ItWorksNow:Sprite = MovieClip(InsideConent.TWO.content).ChildInTWO;  /// 

ItWorksNow.x = 333;  /// I can control property x
ItWorksNow.alpha = .3;  /// I can control the ALPHA! :)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...