Hi Kerry,
The problem is in these lines:
var AssetLibrary:Class;
AssetLibrary=pEvent.target.applicationDomain.getDefinition("AssetLibrary")
as Class;
You are calling a stattic function; so this is correct
AssetLibrary.initAssets();
But why are you defining the same class variable ahead, thats wrong.
Static methods mean you can directly call those APIs without creating an
instance.
So just call AssetLibrary.initAssets() provided you have a AssetLibrary.as
imported.
--
Warm Regards
Deepanjan Das
W: http://deepanjandas.wordpress.com
|| Om Manasamarthadata Shri Aniruddhaya Namah ||
*"Think of the environment before printing this email"*
On Wed, Nov 10, 2010 at 6:47 AM, Kerry Thompson <[email protected]>wrote:
> AS3, Flex 4.
>
> I have an asset swf I'm downloading. It has a public static function I want
> to call to initialize some stuff. FlashBuilder 4 is giving me an error,
> though, and an odd one--"Incorrect number of arguments. Expecting one."
>
> The function I'm trying to call is declared with no arguments:
>
> public static function initAssets(): void
>
> and I'm calling it when the load is complete:
>
> private function handleLoadComplete(pEvent:Event):void
> {
> var AssetLibrary:Class;
>
> AssetLibrary=
> pEvent.target.applicationDomain.getDefinition("AssetLibrary") as Class;
> try
> {
> AssetLibrary.initAssets(); //<--the error is here
> }
> catch (e:ArgumentError)
> {
> trace (e);
> }
> }
>
> They are separate projects in Flex. What am I missing? Do they both need to
> be in the same package? At the moment I don't have a package named. Or do
> they need to be part of the same working set, perhaps?
>
> Cordially,
>
> Kerry Thompson
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders