Go Back   Northcode Support > SWF Studio Plugin Development
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 2007-01-04, 04:02 PM   #1
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
Unable to add plug-in into SWF Studio V3

Hello,

I made a plug-in based on the examples... I can not figure out how to place the example dll or Mine into SWF Studio V3.

any idea?
Jhon is offline   Reply With Quote
Old 2007-01-04, 04:06 PM   #2
Dan
Registered User
 
Dan's Avatar
 
Join Date: May 2003
Location: Ottawa
Posts: 416
Have you tried copying it to the Plugins folder? This is typically C:\Program Files\Northcode\Studio3\Plugins .
Dan is offline   Reply With Quote
Old 2007-01-04, 04:10 PM   #3
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
ok I don't see mine, but I do see CallDLL.
I use VC++ 7, I think it may be cause... I'm doing more tests...

[added]
Nope that is not the case... compiling CallDLL with VC7 seams to work
Jhon is offline   Reply With Quote
Old 2007-01-04, 06:21 PM   #4
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
We found the solution for the problem, it was the C runtime library choice. Apparently, the static runtime needed to be used instead of the shared DLL version.

It's not clear to me yet why this is an issue.

Moreover, it seems that implicit linking of other DLLs also causes the plugin to fail to load. Instead, explicit DLL linking needs to be used, which is rather bothersome.

After a significant amount of code changes on our part, we were able to get the plugin to finally load.

However, the plugin still does not function correctly.
First of all, the check box for our plugin in the 'Plugin' tab is checked, (we also restarted the SWF Studio V3, to make SURE it's able to see our plugin and Studio3 does see it properly). We get no error when we compile the project and we get no error when we load the plugin [ssCore.Plugin.load({plugin:"iPodManagerPlugin", alias:false});]. Also we are able to get the alias with the 'ssCore.Plugin.getAliasesOfPlugin' (which is the same name as the plug-in it self)
- Yet when we call the plug-in, we get SWF Studio 3 trace window, saying: "ERROR: Specified plugin was not included. Make sure it is included in the SWF Studio Plugins tab for your project. "iPodManagerPlugin"".

This makes no sense at all, as the check box for the plugin is checked.

ActionScript Code:
ssCore.Plugin.getAliasesOfPlugin({plugin:"iPodManagerPlugin"}, {callback:"results", scope:_level0});
_level0.results = function(return_obj, callback_obj, error_obj) {
    if (return_obj.success) {
        ssCore.App.showMsgBox({prompt:return_obj.result});
    } else {
        ssDebug.trace("ERROR: "+error_obj.description);
    }
};
ssCore.Plugin.load({plugin:"iPodManagerPlugin", alias:false});
function onHello() { //button
    r = ssCore.iPodManagerPlugin.Init({});
    if (r.success) {
        ssCore.App.showMsgBox({prompt:r.result});
    } else {
        ssCore.App.showMsgBox({prompt:r.Error.description});
    }
}
Jhon is offline   Reply With Quote
Old 2007-01-04, 09:18 PM   #5
AGo
Plugin Developer
 
Join Date: Jun 2002
Location: Germany
Posts: 2,409
You said you are loading another DLL at runtime of the plugin.
The error you mentioned could happen if you try to load the plugin, but the DLL that the plugin tries to load could not been found by the plugin. Where is the loaded DLL located? try to place it into the startdir:// of the exe and see if that changes things.
AGo is offline   Reply With Quote
Old 2007-01-04, 09:19 PM   #6
northcode
Tim
 
northcode's Avatar
 
Join Date: May 2001
Location: Ottawa
Posts: 11,873
You can see the CallDll example, but can you make it work when compiled with VC7? If you compile with VC6 it should work, I'd verify that first.

About static vs. dynamic linking of libraries... Remember that everything the plugin needs has to be present on the users machine when the plugin is loaded. If you depend on external DLLs that may not work out so well since SWF Studio loads the plugins early in the startup process (possibly before the contents of the Files tab are extracted, you can't be sure).

If you use Plugin.loadFromFolder (instead of adding it to the Plugins tab) you get more control over when the plugin gets loaded. That allows you to bundle required dependencies in the Files tab and extract them before you try to load the plugin.
northcode is offline   Reply With Quote
Old 2007-01-04, 09:21 PM   #7
AGo
Plugin Developer
 
Join Date: Jun 2002
Location: Germany
Posts: 2,409
btw, you donīt need to load the plugin again by AS if you include and check it on the SWF Studio Plugin tab and only need one instance
AGo is offline   Reply With Quote
Old 2007-01-04, 10:13 PM   #8
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
(This is Jhon's brother, using Jhon's account)

Quote:
You can see the CallDll example, but can you make it work when compiled with VC7?
Yes. CallDll does compile with VC7 and is correctly loaded by SWF Studio 3. Hello.dll is properly loaded after that and I get the expected behavior.

Quote:
About static vs. dynamic linking of libraries... Remember that everything the plugin needs has to be present on the users machine when the plugin is loaded.
Ah that was it. The machine that runs SS is different from the one that had MSVC installed. Thus, the C run-time was not installed on the system that was supposed to run it. Installing the C run-time seems to have fixed this issue in particular.

Quote:
If you depend on external DLLs that may not work out so well since SWF Studio loads the plugins early in the startup process (possibly before the contents of the Files tab are extracted, you can't be sure).
The DLLs are supposed to already be present on the target system; they will be shipped separately due to various licensing issues. Thus, I do not believe that what you mention is a problem in our case.


Either way, we still have the issue posted by Jhon earlier, which I believe is more critical:
"Yet when we call the plug-in, we get SWF Studio 3 trace window, saying: 'ERROR: Specified plugin was not included. Make sure it is included in the SWF Studio Plugins tab for your project. "iPodManagerPlugin"'."

The plugin is indeed listed in the Plugins tab and is checked. I'd think that that, plus the code that was pasted above, would be sufficient. Is there something else that could be a problem?
Jhon is offline   Reply With Quote
Old 2007-01-04, 10:33 PM   #9
AGo
Plugin Developer
 
Join Date: Jun 2002
Location: Germany
Posts: 2,409
Quote:
Originally Posted by AGo View Post
You said you are loading another DLL at runtime of the plugin.
The error you mentioned could happen if you try to load the plugin, but the DLL that the plugin tries to load could not been found by the plugin. Where is the loaded DLL located? try to place it into the startdir:// of the exe and see if that changes things.
AGo is offline   Reply With Quote
Old 2007-01-05, 08:29 AM   #10
mbd
Registered User
 
mbd's Avatar
 
Join Date: Jun 2002
Location: Ottawa
Posts: 4,430
Btw, DON'T do this:
ssCore.Plugin.load({plugin:"iPodManagerPlugin", alias:false});

Check the docs, the alias parameter is a string: the alias you want the plugin to have. Using false here could confuse the API.

The error message you are seeing is generated by the API itself when you try to use the plugin, and no command is sent outside of Flash. It failed either because the plugin wasn't actually loaded properly at runtime or because of the above command.

As AGo said, the plugins you include at compiletime are already loaded before your main SWF is loaded, and the alias is the name of the plugin. You use Plugin.load to create a new alias for a plugin so that a new instance of the plugin is created.

If you remove the Plugin.load command and still get the same error message, then the plugin isn't being loaded properly at runtime.
__________________

Derek Vadneau (mbd) - Northcode Support

Home | Download Free Trial | Buy / Upgrade
How does SWF Studio Work? | Online Help | Knowledge Base (FAQs) | Examples | Known Issues

ActionScript API:
Code Wizard - New to SWF Studio V3? Step through this wizard and sample code is displayed.

FAQ:
How do I enable synchronous commands?
mbd is offline   Reply With Quote
Old 2007-01-05, 12:28 PM   #11
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
When I use this:
ActionScript Code:
ssCore.Plugin.loadFromFolder({plugin:"iPodManagerPlugin", alias:"MyPlugin", path:"startdir://"}, {callback:"result_plugin", scope:_level0});
_level0.result_plugin = function(return_obj, callback_obj, error_obj) {
    if (return_obj.success) {
        ssDebug.trace({prompt:return_obj.result});
    } else {
        ssDebug.trace("ERROR - "+callback_obj.callback+" : "+error_obj.description);
    }
};

The trace window reports me this: '[object Object]'
When I put it in a dialog box, I get a bunch of XML code. (see attachment)

When I call the plugin:
ActionScript Code:
function onHello() { //button
    r = ssCore.iPodManagerPlugin.Init({});
    if (r.success) {
        ssCore.App.showMsgBox({prompt:r.result});
    } else {
        ssCore.App.showMsgBox({prompt:r.Error.description});
    }
}
I get in the trace window:
"ERROR: Specified plugin was not included. Make sure it is included in the SWF Studio Plugins tab for your project. "iPodManagerPlugin""
Attached Thumbnails
Click image for larger version

Name:	Image1.png
Views:	420
Size:	10.4 KB
ID:	1189  
Jhon is offline   Reply With Quote
Old 2007-01-05, 01:06 PM   #12
mbd
Registered User
 
mbd's Avatar
 
Join Date: Jun 2002
Location: Ottawa
Posts: 4,430
Quote:
The trace window reports me this: '[object Object]'
That's because you are passing an object to ssDebug.trace. ssDebug.trace, to make it quicker for debugging, doesn't take an object but just a string:
ssDebug.trace(r.result);

Not sure where you got that ssDebug.trace had a prompt parameter ... copied from ssCore.App.showMsgBox?

You shouldn't actually be seeing anything in the result output parameter, since Plugin.loadFromFolder doesn't have an output parameter, but that's a minor issue with the core not removing that during some internal calls. You're seeing the result of ssCore.Plugin.getManifest, which gets the manifest of the plugin for use by the core.


You are issuing the command:
ssCore.iPodManagerPlugin.Init({});

But you specified the alias as MyPlugin, so your call should be:
ssCore.MyPlugin.Init({});

The plugin parameter is used as the name of the plugin to load. The alias is what you use in your ActionScript calls. If you wanted to be able to specify iPodManagerPlugin, just specify that as the alias.
__________________

Derek Vadneau (mbd) - Northcode Support

Home | Download Free Trial | Buy / Upgrade
How does SWF Studio Work? | Online Help | Knowledge Base (FAQs) | Examples | Known Issues

ActionScript API:
Code Wizard - New to SWF Studio V3? Step through this wizard and sample code is displayed.

FAQ:
How do I enable synchronous commands?
mbd is offline   Reply With Quote
Old 2007-01-05, 03:41 PM   #13
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
Quote:
Not sure where you got that ssDebug.trace had a prompt parameter ... copied from ssCore.App.showMsgBox?
Yes I replaced with ssCore.App.showMsgBox.


My code:
ActionScript Code:
ssCore.init();
ssCore.Plugin.loadFromFolder({plugin:"iPodManagerPlugin", alias:"iPodManagerPlugin", path:"startdir://"}, {callback:"result_plugin", scope:_level0});
_level0.result_plugin = function(return_obj, callback_obj, error_obj) {
    if (return_obj.success) {
        ssCore.App.showMsgBox({prompt:return_obj.result});
    } else {
        ssDebug.trace("ERROR - "+callback_obj.callback+" : "+error_obj.description);
    }
};
function onHello() {
    r = ssCore.iPodManagerPlugin.Init({});
    if (r.success) {
        ssCore.App.showMsgBox({prompt:r.result});
    } else {
        ssCore.App.showMsgBox({prompt:r.Error.description});
    }
}

Same error as before
"ERROR: Specified plugin was not included. Make sure it is included in the SWF Studio Plugins tab for your project. "iPodManagerPlugin""

If I check the box in the plugin tab in SS3, and just apply this code:
ActionScript Code:
ssCore.init();
function onHello() {
    r = ssCore.iPodManagerPlugin.Init({});
    if (r.success) {
        ssCore.App.showMsgBox({prompt:r.result});
    } else {
        ssCore.App.showMsgBox({prompt:r.Error.description});
    }
}

I get the exact same error.
I am seriously thinking, that it MAYBE a problem with SWF Studio 3.3 build 120


_______________________________________________________________________
NOTE:
When I run my project (which has nothing more then the code that you saw above), and check in the Temp directory, I can see both the dll's (2) I need (my plug-in). So they are there.... just SS3 seams to not be able to communicate with it, or unable to see it for some reason.

This is what I tried.. I added filesys plug-in with my project and build. WHILE my project is running, I go to the Temp dir. and try to delete all the files...
All files gets delete, while my project is loading exept for these:
- filesys.dll
- ipodManager.dll (build with VC++ 7)


'libipod.dll' (the associated dll file with ipodManager.dll) (build with VC++ 7) gets deleted.

Just saying, in case it may help.
Jhon is offline   Reply With Quote
Old 2007-01-05, 04:57 PM   #14
Dan
Registered User
 
Dan's Avatar
 
Join Date: May 2003
Location: Ottawa
Posts: 416
Did I read this correctly? Your plugin is call iPodManager (that's from the file name), right?

If so, the internal property (Plugin_Name) should be "iPodManager", and your code should be:
Code:
ssCore.Plugin.loadFromFolder({plugin:"iPodManager", alias:"iPodManagerPlugin", path:"startdir://"}, {callback:"result_plugin", scope:_level0});
The "plugin" parameter has to be the name of the DLL. The "alias" can be anything you want, and is the name you will refer to in your Flash code.
Dan is offline   Reply With Quote
Old 2007-01-05, 05:54 PM   #15
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
Oups, I wanted to say iPodManagerPlugin.dll and NOT iPodManager.dll

Just now I checked if I got the naming right EVERYWHERE, and yes it was and still is correct.
Jhon is offline   Reply With Quote
Old 2007-01-06, 08:06 PM   #16
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
We performed a lot of tests, and it seams we can not find the problem.
The commands inside our Flash application seams correct based on your help document. And the code of the plug-in are based from your examples.

We would seriously appreciate, if you take time and have a look into it.
We can send you both of the *.dll (compiled) files to you via e-mail.
Jhon is offline   Reply With Quote
Old 2007-01-06, 10:16 PM   #17
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
Actually, when we edit the code in Flash to load CallDll, everything works like a charm.

So the code in Flash is perfect. Can we have a special build of SWF Studio V3 with more debugging functionalities. Because the error message we get not really helpful.

Is there something special we need to be at the look-out in the compiling options for the plugin dll?
Jhon is offline   Reply With Quote
Old 2007-01-07, 02:21 AM   #18
northcode
Tim
 
northcode's Avatar
 
Join Date: May 2001
Location: Ottawa
Posts: 11,873
Quote:
Actually, when we edit the code in Flash to load CallDll, everything works like a charm.
Sounds like the problem might be in your plugin. If it's not loading then it may be something in the initialization. Does the DLL actually get loaded? Without seeing the code it's tough to guess where it could be going wrong.
northcode is offline   Reply With Quote
Old 2007-01-07, 10:00 PM   #19
Jhon
non compos mentis
 
Jhon's Avatar
 
Join Date: Dec 2002
Location: Canada, Montreal
Posts: 2,793
We have seamed to resolved our problem...
It was compiling options and that we skip this line when reading code:

//Plugin_Name must match the name of the DLL.

Oups!

Request:
SWF Studio 3 needs more to have a better error report for plugins and/or documentation!
We were about to give up the use of Flash and make everything in C++.
Jhon is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes