I can reproduce the same runtime error in Flex 2.01
--- In [email protected], "Rich Germuska"
<[EMAIL PROTECTED]> wrote:
>
> 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
> tentLoaderInfo_completeEventHandler()[E:\dev\flex_3_beta3
>
\sdk\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1648]
>
> Many thanks, Rich
>