|
-
Targeting a loaded swf
Hi all
1. I'm loading an external swf onto my main swf.
2. Then I'm tweening an object which is separate to the loaded swf.
3. When the tween has completed I'm calling a function to make the loaded swf gotoAndPlay(2);
It all works apart from telling my loaded swf to play. I'm really stuck please help.
The code which I'm using is:
//
import caurina.transitions.Tweener;
//load swf
var externalSwf:Object;
this.myRequest=new URLRequest("orange.swf");
this.myLoader = new Loader();
this.myLoader.contentLoaderInfo.addEventListener(E vent.COMPLETE, grabContent);
this.myLoader.load(this.myRequest);
//tween object
function grabContent(event:Event):void {
externalSwf=event.target.content;
Tweener.addTween(banana, {x:-900, time:1, transition:"easeInCubic", onComplete:nextBuild});
}
//control loaded swf
function nextBuild() {
externalSwf.gotoAndPlay(2);
}
stop();
-
Senior Member
Are you getting an error?
- The right of the People to create Flash movies shall not be infringed. -
-
Not getting any errors. I've used trace(); to confirm that each part is working. It's just not perfoming that last request.
-
Senior Member
So the nextBuild function is not executed or it is but the externalSwf.gotoAndPlay(2); is not executed?
- The right of the People to create Flash movies shall not be infringed. -
-
externalSwf.gotoAndPlay(2); is not being executed. The function is working as I have a confirmed trace. I can send you the flash files if want to see in detail. Thanks
-
Senior Member
Post them here so others can have a look too.
- The right of the People to create Flash movies shall not be infringed. -
-
Here are all the files
example
Last edited by imagesinmotion; 11-12-2009 at 09:18 AM.
-
Senior Member
You need to add the Loader to the Displaylist:
var myRequest:URLRequest = new URLRequest("orange.swf");
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, grabContent);
myLoader.load (this.myRequest);
addChild(myLoader);
- The right of the People to create Flash movies shall not be infringed. -
-
Thanks for your help cancerinform
The working code is as follows, if anyone needs the files contact me and I will send them on.
//import for the tween
import caurina.transitions.Tweener;
//load the external swf
var externalSwf:Object;
var myRequest:URLRequest=new URLRequest("orange.swf");
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE, grabContent);
myLoader.load(this.myRequest);
addChild(myLoader);
//when the swf is loaded, the tween is initiated
function grabContent(event:Event):void {
trace("swf has been loaded");
externalSwf=event.target.content;
Tweener.addTween(banana, {x:-900, time:1, transition:"easeInCubic", onComplete:nextBuild});
}
//when the tween is complete, play the swf
function nextBuild() {
trace("the tween has completed and has initiated the nextBuild function");
externalSwf.gotoAndStop(2);
}
stop();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|