Targeting/controlling stage from external loaded swfs AS3

  • clarem001
  • Born
  • Born
  • clarem001
  • Posts: 2

Post 3+ Months Ago

Hi there,

I need some help urgently. I'm relatively new to AS and have just got to grips with AS2 when blow me down AS3 has appeared! Making my life that much harder...Anyway I have a question I cannot seem to find the answers for.

I have loaded 3 external .swfs including 1 .flv file into a main loader movie (stage). I need to be able to target the main loader or the main movie's timeline from the externally loaded files.

This is the code I have used to call the external files into the main movie:

stop();

fscommand("fullscreen", "true");

var myrequest:URLRequest=new URLRequest("RSA-stats-rolling-demo.swf");
var myloader:Loader=new Loader();
myloader.load(myrequest);

function swfLoaded(myevent:Event):void{
stage.addChild(myloader);
var mycontent:MovieClip=myevent.target.content;
mycontent.x=0;
mycontent.y=50;
}
myloader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);


Basically I want to be able to send and control the main movie timeline or send actions through from the external swf to the main timeline. Say to stop, play, goto etc. Even to trigger the Loader on the main timeline to load movie 2, then movie 3 etc.

I cannot make all movies 1 large movie they have to be attached as 3 separate swfs and flvs.

I hope you can help!
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

It's all about proper targeting and scoping. Actionscript 3.0 has significantly changed much of their notation, but scoping is very similar. Where previous versions of flash you could use Stage, _root, or _parent as prefixes AS3.0 uses stage, root, and parent (no underscores and all lowercase). So depending on how your movies are set up your code will most likely look like this from an external movie...


parent.mycontent.DoThis();


you want to stay away from stage as it causes a mess of scope coding. root does the same thing. It makes your code highly unportable and can cause other issues. It's best to stick with tracking back in your scope using parent until you are back to the timeline you need to be in.
  • clarem001
  • Born
  • Born
  • clarem001
  • Posts: 2

Post 3+ Months Ago

thanks

I also have a second question relating more to the flv file i wondered if you could have a look at this?

Basically because the flv does not play a movie on the timeline as it would if it is embedded in an swf I have no reference point (on a timeline) to call another movie to play after it has finished.

How would you approach that? Would you listen to the bytes loaded till the flv loads, plays and ends and then call the next movie to play? Or something similar? Problem is there's no button click action to 'play next' with this so I'm having to rely on Event Listeners.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.