Thanks for catching this one Alex.

No it doesn't matter which one I load first, because I only ever load 
one at a time at this stage of development. I just change the SWF 
source string in an external catalog.xml file to switch between the 
two SWFs.

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Does it matter which one you load first?  Is it the second that 
always
> fails?
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Rich Germuska
> Sent: Sunday, December 23, 2007 1:19 PM
> To: [email protected]
> Subject: [flexcoders] TypeError: Error #1006: getShape is not a
> function. (Sometimes...)
> 
> 
> 
> Hi,
> 
> I'm getting a #1006 runtime error, that's puzzling me.
> 
> I load a CS3 SWF into Flex using a custom SWFLoader called 
SWFWrapper.
> 
> In SWFWrapper I cast the SWF timeline as a MovieClip and access an 
> AS3 instance method in the SWF called called getShape
> (shapeNumber:String) as follows:
> 
> "SWFWrapper.as"
> 
> public function get rugSWF():MovieClip
> {
> return this.content as MovieClip;
> }
> 
> // Retrieve reference to correct UIMovieClip by calling swf's
> // function getShape()
> 
> var s:UIMovieClip = rugSWF.getShape(shapeNumber);
> 
> // Do funky things to UIMovieClip
> 
> "rug.swf"
> 
> function getShape(shapeNumber:String):MovieClip {
> var shapeNum:String = shapeNumber;
> return this["shape_"+shapeNum];
> }
> 
> And everything is working nicely...
> 
> I then load a different SWF to Flex - that contains the same 
methods 
> and instance variables (the AS3 is code generated using JSFL)
> and I get the #1006 error.
> 
> I've compared the two swf's and can't see any unintended 
differences. 
> Are there any mystical settings I should know about? Flash IDE and 
> timelines etc are not my strong point.
> 
> Here's the Flex error stack:
> 
> TypeError: Error #1006: getShape is not a function.
> at com.treelinerugs::SWFWrapper/setShapeColor()
> [C:\DATA\Business\RIA 
> 
Data\flex3WorkspaceRug\treelinerugs\com\treelinerugs\SWFWrapper.as:106
> ]
> at com.treelinerugs::SWFWrapper/setAllShapeColors()
> [C:\DATA\Business\RIA 
> 
Data\flex3WorkspaceRug\treelinerugs\com\treelinerugs\SWFWrapper.as:79]
> at com.treelinerugs::SWFWrapper/initSWFWrapper()
> [C:\DATA\Business\RIA 
> 
Data\flex3WorkspaceRug\treelinerugs\com\treelinerugs\SWFWrapper.as:40]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at mx.core::UIComponent/dispatchEvent()[E:\dev\flex_3_beta3
> \sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:9041]
> at 
> 
mx.controls::SWFLoader/http://www.adobe.com/2006/flex/mx/internal::con
> <http://www.adobe.com/2006/flex/mx/internal::con> 
> tentLoaderInfo_completeEventHandler()[E:\dev\flex_3_beta3
> 
\sdk\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1648]
> 
> Many thanks, Rich
>


Reply via email to