Search the web
Sign In
New User? Sign Up
flashmn · Twin Cities Flash User Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
addChild to external loaded swf   Message List  
Reply | Forward Message #4148 of 4864 |
Re: [flashmn] addChild to external loaded swf

I think I found the answer: http://www.flashandmath.com/intermediate/externalclips/ext_clip1.html


On Tue, Aug 26, 2008 at 10:32 AM, Jacob Berendes <jake@...> wrote:

I guess the way I would handle it is to create an empty movieclip and place the entire group, variables and all, inside.
Then setup a text area with in that movieclip and your batch of time line controls as well.

It really wouldn't be much more code than what you already have.
Also, the Loader class is a bit of a pain and should have been rewritten years ago.  After 3 tries to load a swf or jpg it will say COMPLETE even if the movie has not loaded yet.
I ended up writing my own loader class as a result.  Most of the code is based on the original Loader class but forces the loader to actually load the swf or image before firing an event.COMPLETE.

-Jake

__________________________________________________________
Jacob A. Berendes | Web Design / Development Specialist | Artropolis, Inc.
8401 Wayzata Boulevard, Suite 310 | Golden Valley, MN 55426
952-545-8488 x 103 | fax 952-545-8516 | http://www.artropolis.com


Robert Fraher wrote:
Darn!

I actually took extra care formatting this for email. Attached is an RTF doc with the cleaned-up code.





On Aug 26, 2008, at 9:14 AM, Robert Fraher wrote:

Hi, Robert -

I've had good luck working with the structure outlined below:

var _contentHolder:MovieClip = new MovieClip();var _externalSWF:Object = new Object();function loadAsset(assetURL, onAssetLoad):void {//var assetLoader:Loader=new Loader;var request:URLRequest=new URLRequest(assetURL);//assetLoader.load(request);assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onAssetLoad);}
function initializeContentHolder(event:Event):void {//var loaderInfo:LoaderInfo = event.target as LoaderInfo;_contentHolder.addChild(event.target.content);_externalSWF = loaderInfo.content;}loadAsset("externalSWF.swf", initializeContentHolder);
Using this approach, I target _contentHolder for any display activity (scale, rotation, etc.), and _externalSWF for any data (variables, MCs, etc.).

I hope this helps.

Bert

On Aug 25, 2008, at 11:56 PM, comeexplorecanada wrote:

Hi,

I am trying to add a TextField to a load external swf. Does anyone
know how to do this in AS3? Here is what I have tried (of course it
doesn't work):

private function addPage():void {
var request:URLRequest = new URLRequest("page1.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);

var txt_0:TextField = new TextField();
txt_0.text = "Sample Text";
loader.addChild(txt_0);
}

Also in the future I would like to control the timeline of an loaded
external swf. Anyone know what it takes to be able to do this?

Robert S.


Robert Fraher
Candidate for M.F.A. in Interactive Design
University of Minnesota



Robert Fraher
Candidate for M.F.A. in Interactive Design
University of Minnesota




Tue Aug 26, 2008 6:11 pm

comeexplorec...
Offline Offline
Send Email Send Email

Forward
Message #4148 of 4864 |
Expand Messages Author Sort by Date

Hi, I am trying to add a TextField to a load external swf. Does anyone know how to do this in AS3? Here is what I have tried (of course it doesn't work): ...
comeexplorecanada
comeexplorec...
Offline Send Email
Aug 26, 2008
7:04 am

Hi, Robert - I've had good luck working with the structure outlined below: var _contentHolder:MovieClip = new MovieClip(); var _externalSWF:Object = new...
Robert Fraher
robertfraher
Offline Send Email
Aug 26, 2008
2:12 pm

Darn! I actually took extra care formatting this for email. Attached is an RTF doc with the cleaned-up code.  ... Robert Fraher Candidate for M.F.A. in...
Robert Fraher
robertfraher
Offline Send Email
Aug 26, 2008
2:19 pm

I guess the way I would handle it is to create an empty movieclip and place the entire group, variables and all, inside. Then setup a text area with in that...
Jacob Berendes
superjaw911
Offline Send Email
Aug 26, 2008
5:45 pm

I think I found the answer: http://www.flashandmath.com/intermediate/externalclips/ext_clip1.html...
Robert S
comeexplorec...
Offline Send Email
Aug 26, 2008
6:11 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help