PDA

View Full Version : Problems with callfunction when using Excel as the flash Container


awigmore
01-14-2007, 03:46 AM
Hi there

I am trying to embed my flash control into Excel and need two way communication via teh ExternalInterface (ie call from my AS and CallFunction from my VB). Thngs generally work however I am getting the following error using the callFunction command in Excel VBA:

"Run time error '-2147467259 (80004005)'
Method 'CallFunction' of object IShockwaveflash failed

I have tried thesame code in javascript and regular Visual Basic 6 and have no problems. I have also played with the security settings of teh flash sandbox to see if that was at fault but nothing was required for VB6 so I am not sure that this is the right approach. I am using Excel 2003.

Is there a restriction in using the ActiveX container in Excel in some way?

Regards
Andrew

awigmore
01-15-2007, 02:39 AM
I have done a bit more research and have created a Visual Basic 6 Control that wrapped the Flash a/x control.

If I run this control in a standalone application then all is fine. However if I use this control in Excel then I get the same message. This means there is something when running in the Excel context that is causing the grief...

Seems to point to security (on the Excel side I think) but I can't quite figure out what that would be. Still I have a path to research...

- Andrew

bermarte
11-26-2007, 04:13 PM
Sir,
I do not have an answer but as I read your post I would like to ask you back a question.
This because it seems that You used Callfunction with success.
Do you have a very basic example using callfunction method on vb 6 and flash 8?
I am using Flash9d.ocx.
Thank you in advance.

bermarte
11-27-2007, 06:52 PM
A basic example of CallFunction would be:
FLASH 8 (create a text field on stage named myText):

import flash.external.ExternalInterface;
function show(str1:String,str2:String):Void{
myText.text=str1+" : "+str2;
}
flash.external.ExternalInterface.addCallback("show",null,show);
VB 6 (create a button named cmdSwf and paste this code, insert a Flash object named Flobj):

Private Sub cmdSwf_Click()
Flobj.CallFunction "<invoke name=""show"" returntype=""xml""><arguments><string>hello</string><string>world</string></arguments></invoke>"
End Sub

d880640
02-15-2008, 03:26 PM
You said the word "security" and it got me thinking, you may need to do this:
in Excel go to:
Tools|Macro|Security|set it Low|Trusted Publishers| check "Trust access to Visual Basic Project"
then press Ok

I am trying to build an Flash frontend to excel also.
hope that helps
Dave

awigmore
02-16-2008, 10:25 AM
Hi there

I tried playing with the Excel macro security options and have had no luck.

Regards
Andrew

SimpleMindedCoder
06-26-2008, 05:03 PM
I'm running into the same issue. I've also noticed that you can't call EnforceLocalSecurity() on the ActiveX wrapper in Excel either, but you can in a stand-alone desktop app. You can call .NET methods from Flex, but not the other way around, which is weird. One theory is that the addCallback call from Flex is failing for some Flex security reason, but for some reason you don't get a Security error raised in the Flex code. Another is that maybe there's some issue with unmanaged code in Excel calling into a managed code wrapper that calls into the unmanaged code in the Flash control. Don't know - it's frustrating though.

xdrone
10-26-2008, 02:10 PM
Hi all

I have change all security to bypass, and checked that the swf opens without any restrictions in IE. Tried to call an actionscript function from a container. I got the same error.

Error -2147467259 occurred at Unknown / (Hex 0x80004005).

Now I know it is not any security issue.

I am thinking it is the xml code that is supposed to invoke the command in flash script.

Here is a sample of it:
<invoke name="changetext" returntype="xml"><arguments><string>"testestest"</string></arguments></invoke>

where changetext is a function defined in flash:

function changetext (mystring:String)
{
this.myinputtext.text = mystring;
}

I used the xml line above in the argument passed to callfunction.

I tried everything else, actionscript 2 and actionscript 3.
I can change any variable in the swf directly from the container and i can receive fscommands from the swf to the container.

So why the heck i can't call the freaking callfunction?

Please grant us your ideas, because this is taking far more effort than necessary. I still didn't figure this out since 3 months now.

Thanks
xdrone

pj-co
10-26-2008, 02:41 PM
it's amazing to me the things pepople attempt with flash. a very good kind of amazing, but amazing nonetheless :)

tulip
04-07-2009, 12:09 AM
Is this problem resolved? I got the same problem and haven't found a solution :(. I really appreciate if anyone can share the solution. If I find a solution, I'll post it here too.

Thanks!

jsimpson
04-07-2009, 12:15 AM
I'm just curious, what would you do with flash inside of an excel spreadsheet?

neilb2
12-18-2009, 04:29 PM
I am getting the same problem. I am trying to use adobe flex embeded in excel as it produces flashier charts.

droopy6
09-10-2011, 11:54 PM
take a look at this:

https : //bugs.adobe.com/jira/browse/SDK-20726?focusedCommentId=453891&page=com.atlassian.jira.plugin.system.issuetabpane ls%3Acomment-tabpanel#action_453891