by Jaspal Sohal |
11 January 2006You should now see the Command List display all of the
functions contained in your kernel32.dll file. Scroll through the list of
functions in the Command List and select the kernel32.Beep function:
With kernel32.Beep selected in the functions column, click on the "Extension
Definition" Tab and enter the details as shown below:

[ ensure your Extension Definition
panel contains the same data ]
The Extension Creator allows you to specify up to 12 parameters
for each DLL Function. From the reference in Step 1, we know that only 2
parameters are required for the Beep Function. Set Parameter 1 and 2 to
"integer" from the drop down box and complete the Description and Sample Value
for each. For the purpose of this example, set the value for each parameter to
1000.
You can also specify a return value at the bottom which, although not required,
can help assist in debugging your custom command. In this case, we know from the
DLL Function documentation that the return value should be a Boolean.
Click on the "Command Tester" Tab. The bottom-half of your window should look
like the following:

[ Command Tester area ]
With the parameters set and sample values provided, we can now
proceed to testing our command. Upon first test, you need to Load the Library by
clicking on the "Load Library" button at the bottom. Once loaded, click on the
"Execute" button to test. When clicked, you should here a System Beep which
lasts for approximately 1 second.
The exact syntax as it should be entered in your ActionScript is also generated
in the Code Pane. The value "true" should also be visible in the Result Pane. If
your test failed to play the beep sound, then the value "false" should be
visible in the Result Pane which would mean that communication was made but a
parameter or multiple parameters were incorrectly specified.
Once you are happy that your new Custom Command is working correctly in the
Command Tester, click on File and Create Extension:

[ select Create Extension from the File
menu ]
This will allow you to specify an extension name and path to
save to. The extension file format is .zincx - this is the file that you
can distribute and share with other users. Once you have created your Extension
file, exit the Extension Creator.
Now, create a new file in Macromedia Flash (or your preferred
SWF Authoring tool) and add a button with the following code which has been
copied from the Command Tester:
- on (release)
{
- myResult =
mdm.Extensions.KERNEL32.Beep("1000","1000");
- }
All Custom Commands created with the Extension Creator always
follow this format:
- mdm.Extensions.CUSTOMCLASS.DLLFUNCTION()
In this case, the CUSTOMCLASS name is "KERNEL32" and the
DLLFUNCTION name is "Beep". Please Note that these items are case sensitive, so
be sure to enter the command exactly as it is shown in the Extension Creator.
Create a Dynamic Text box on the canvas and label it "myResult" and export your
SWF movie.
If you have any questions, please post them on the
MDM support forums.
 |
page 3 of
3 |
|
|