Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Volume Control-Button Only
Sprite on/off
Pie Chart - Vector Shapes
3d 1st-person shooter
Timehouse Speech Xtra
A Simple Coloring Book
Mosaic-Alphamania
Roil-Alphamania
Puttin all functionality in one button behavior
Mastering Macromedia Director 6
 

 

 

Article Director in Other Programs

Added on 5/1/2000

 

Compatibilities:
D7 D8 PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

How can I put my Director 7 or 8 piece into Authorware, or any other application, and have it interact?

Get the source
This is a place where Shockwave can really be helpful.  On the PC you have a great thing called ActiveX that can help out a lot here.  Like Director, Authorware has an ActiveX Xtra that allows it to insert various controls to quickly add functionality from other applications.  Shockwave also has an ActiveX control, so with it we can inset Director/Shockwave files into any Authorware 5 piece.  Start by inserting an ActiveX control into the flow line.  Select the Shockwave control and click OK.
(Exhibit 1)

The next step is to add a calc icon that will assign the filename for the Shockwave piece.  Since the path on each machine could be different we set this after the icon is loaded and use a dynamic path.

        SetSpriteProperty(@"Shock", #src, FileLocation^"test.dir")

The Authorware piece now needs to wait for any command sent by the Director piece.   This is accomplished by adding and interaction Icon to the flow line and setting the first item to be an "event".  In the event properties select the Shockwave ActiveX control and activate the "externalEvent" in the "Event Name" box.
(Exhibit 2)

From this we can add in code to interpret the event and set a variable accordingly.   When Authorware intercepts an event it returns the results in the list called EventLastMatched.  The event we want to look for is #__EventName (note the 2 "_" characters).  If this is an #externalEvent then we want to get the results that Shockwave sent, which will be in the #bstrEvent.

    if EventLastMatched[#__EventName] = #ExternalEvent then
        whatPath:= EventLastMatched[#bstrEvent]
    end if

Now that we have a path we can continue through the flow line and use the variable.   This is an example of how the flow line might look.
(Exhibit 3)

So how do we send the command from the Director side?  Director uses a command called "externalEvent" to pass information out.  This info can only be a string and may not have any quotes in it.  For example...

"value=1"
Would be a valid string
"value=" & quote & "1" & quote
Would not.

The Director code would look something like this...

    property spriteNum, whatNumber

    on mouseUp me
        externalEvent(string(whatNumber))
    end

    on beginSprite me
        whatnumber = spriteNum
    end

The reverse is called evalScript.  Sending an evalScript message to the control will allow Director to read in the string sent and then do any code in the evalScript handler.

This same setup can be applied to other programs like Visual Basic, Web browsers using VB script or JavaScript, or any other program that accepts ActiveX controls.

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail