tags:

views:

20

answers:

0

I have been trying to call ActionScript code from my container and get the message

Error : Object doesnt support this property or method.

Here are some salient fragments of my code

DataGrid.mxml

...
<mx:script source="DataGrid.as3"/>
...

<mx:DataGrid ... initialize="initDG()" ... >

DataGrid.as3

...
public function addEntry():void
{
}

public function initDG():void
{
    if (ExternalInterface.available)
    {
        ExternalInterface.addCallback("addEntry", addEntry);
    }
}

...

DataGrid.jsp

...
function addNewEntry()
{
    getFlexApp("gridID").addEntry();
}

function getFlexApp(appName)
{
    if (navigator.appName.indexOf("Microsoft") == -1)
    {
        return document[appName];
    }
    else
    {
        return window[appName];
    }
}

<input type="button" value="Add Entry" onClick="addNewEntry()"></input>
<embed id="gridID" name="gridName" src="DataGrid.mxml.swf"></embed>

I get the error "Error: Object doesnt support this property or method" when I call getFlexApp("gridID").addEntry();

Any help with this would be very gratefully received.