Hi all,

 

I’m having a very specific problem with createChild calls that I will try to sum-up as briefly as possible:

 

A.SWF loads B.SWF through a Loader component, both are originally flex applications. A invokes a particular method on B, passing down an instance of Panel. In this method, B tries to perform a createChild call on the passed panel, using a class definition contained only in B and not in A. This results in a HTTP request being made (http://localhost:8888/WebApp/[type%20Function]) – looking at the Flex source, this seems to be the result of an attachMovie call returning undefined, causing a call to loadExternal from within the createClassObjectWithStyles method in the View class.

 

The documentation for MovieClip.attachMovie (http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001487.html#3998340)

 seems to suggest that what I’m trying simply cannot be done (without including a reference to the class to be created within A.SWF, which defeats the purpose of this slightly). From the documentation comments:

 

------------------------------------------------------------------------------------------------------------

chi chi latté said on Feb 16, 2005 at 2:52 PM :

I was having problems attaching symbols into mcs loaded dynamically using loadMovie().

Somebody's written above that it's not too easy...

>> No screen name said on Oct 6, 2004 at 1:42 AM :
>>
>> Anyone know if the movieclip used in the attachmovie call must belong
>> in the current clip's library? (and not the library of an external swf)
>> It doesn't seem to attach them if this is the case.
>>
>>JohnGrden said on Nov 5, 2004 at 7:44 AM :
>> Yes, the linked clip MUST be in the library of the clip calling >>attachMovie.

Well you can do it without too much bother.

If you are using loadMovie(), and you're attaching clips into it and out of it, just make sure the symbol is in both libraries (being exported in one swf, and imported in the other), and place the imported symbol onto the stage of the swf which does not have the symbol native to its library. That make sense?
Note: you _have_ to place it on the non-native stage. Setting it as "imported" in the library is not enough. I put them hidden for one frame.

This is really useful if you've got a big project of several swfs, and you want to attach some common mcs into the loaded swfs.

Hope that helps+is not too garbled

------------------------------------------------------------------------------------------------------------

 

mspres said on Mar 10, 2005 at 12:57 PM :

Note: attachMovie() WILL work with shared asset symbols unless the movie is loaded into another movie. For example, consider that assetsUser.swf uses attachMovie() on shared asset symbols imported from assets.swf. This works fine until a third movie, assetsUserLoader.swf is used to load assetsUser.swf. Preloading the assets.swf with assetsUserLoader.swf does not solve the problem. The only solution is to include design-time instances of the shared asset symbols on assetsUser.swf stage; which, defeats the reasoning for using attachMovie.

The root of this bug and its various symptoms span across many topics.

 

------------------------------------------------------------------------------------------------------------

 

Can anyone confirm this definitely cannot be done, and there is no work-around? (Note that debug statements show everything else up as being ok, the method on B is invoked, the class definition is visible, the parent’s panel reference is fine, I’m 99% sure it’s the attachMovie call that is returning undefined).

 

Any advice, suggestions etc greatly appreciated. Thanks in advance!

 

(Code samples can be provided if it would help).

 

Cheers

Mike

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to