This content has been marked as final. Show 20 replies
A function like you have written would normally be in a behavior script
window. That behavior would then be attached to a sprite, your button,
You don't say how button1 is defined. If its a named sprite that holds
this behavior then you don't need the reference. Me refers to the sprite
that holds the behavior. Me is in most respects, very similar to "this"
If button1 is the name of a sprite other than the sprite that holds the
behavior, then you would refer to it like this:
In any case, the name of a sprite is a string. If you don't name the
sprite then its channel number is a number.
If button1 is a cast member's name, then you don't normally refer to the
member name in that way.
OpenFile() is a fileIO xtra function. You need to create an instance of
the xtra before you can call it's functions. If button1 is the name of
the xtra's instance, then it may be out of scope. In order for it work
in your example, button1 would have to be a global or property variable.
Adobe Community Expert
wow... I understood not a single thing of what you just said. Director really is quite difficult.
While I'm still pottering about Director trying to find this green wrinkley sprite everyones talking about, would you mind either pointing me, or write me a quick example of how I would open an *.exe file? I believe its something like this:
Thank you for your help
Assuming that notepad is indeed in the root of your C:\ drive (which it
is normally not), you would do this (you had it real close, but had the
Sorry to sound simple, but where exactly was it I actually put this? I slowly getting my head around this sprite - behaviour system, but somehow I'm going wrong. I think I'm trying to use it like Flash.
In Flash I used to write all my script in that _root. But in Director I can't find it. :)
Could someone start my from a blank movie where this bit goes, please
Ahh, yes, sorry. I think I was just getting in a muddle. I'm sure I'll lose how to get to it again, but were there now, thats what matters :)
I can get this script to run fine:
My idea was to run this from a CD, loading the choosen folder from the CD. (I have successfully done this now.) However, I can't get it to load something from my desktop (if that WAS where I wanted to go), I read its something to do with needing FileIO?
In Flash you can write actionscript into either a frame script space or,
to a limited extent, right on the object that you want use.
In Director you normally write your code as a behavior and then attach
that behavior to any number of sprites in the score. You can also write
behavior style functions into the frame script space in the score.
Additionally, you can write movie wide functions into movie script
windows. There are two script window types, behavior and movie.
Code that you write into a movie script is not attached to anything and
has no direct connection to either the stage or the score. In a movie
script window you can write any number of functions, and use as many
windows as you like. This is somewhat similar to writing actionscript
into a movie frame space.
Any original content for a Director movie is placed into a cast. Every
cast member has the same precedence. There is no heirarchical structure
to Director assets as there is in Flash. Any cast member that is placed
on the stage, or in the score, is an instance of that cast member and is
called a sprite. You can only place one cast member instance in any
sprite channel at any given frame. This is very differnt from Flash
where you can place every asset into the same layer.
Every sprite is self aware and self referential. It does not need to be
assigned as a "button" or a "symbol" in order to be controlled. It does
not need to be named in order to be addressed. A sprite does not need to
be in the first frame of the score in order for Lingo to recognize it.
Behavior code is usually written so that it can be assigned to any
number of sprites. For instance, you can write one:
go to the frame
function. And then use that throughout the score to stop the playback
head. In Flash you have to write an individual stop(); function in any
keyframe where you want to stop the playback head.
If you want to open an executable from a user action in your movie, you
1. create the button artwork. If you want a complex button, you'll have
to create one cast member for each state of the button.
2. To operate the button, you can use one of the behaviors in the
Library. You can also use one of these behaviors to have the cursor
change. Attach these behaviors to the button sprite by dragging it from
the Library to your sprite on the stage. If there are settable parameter
values needed, then a window will open.
3. To have this button call that executable, open the behavior that you
attached and find the "on mouseUp me" function. Then you can add the
open() function call to that function. If you need to find the user's
desktop from your projector, you can use any of the OS xtras. BuddyAPI
and fileXtra4 are the most popular. Each one comes with instructions.
Most of this is covered in the tuturials that come with Director. You
may want to look at those.
Adobe Community Expert
not sure if this will help you, but I have a flash vs director section on my site that I wrote as well as Lingo to Actionscript translator (which will go both ways)
not really an app as much as it is a guide...you'll see
hope this helps
Thank you both for you help. After spending a few hours/days blurrly staring at the screen, some of this is starting to make sence.
Kyleg, I thought your website was very good. I read the Flash v Director, I couldnt agree more. I'd hate to sound like the new-comer complaining, but there are alot of differences between the two packages which I don't yet see why. They both have some great features, but from a guess, Directors scripting is most likely a simplified version of Flash (like Flash is of C++). I only say this becuase if Lingo was a better (more complex) language to script with, then Flash would certainly use the better of the two.
Rob, what you said does make sence, I think I will be able to get my head around where scripts are to be placed now.
BTW: Kyleg, in your translator, I think Directors 'property list' is a comparison to Flash's 'array'... not that I know what a property list, but they look similar.
Actually Lingo is a much more elegant and useful scripting language than
Actionscript. Lingo was based on Apple's hypercard scripting, which was
Lingo's property lists are similar to Actionscript associative arrays,
but are infinitely simpler to use. Lingo lists are similar to
Actionscript arrays, but, again are simpler to use.
Adobe Community Expert
I'll let you know when its getting simplier ;)
Here's another one for you, which we're on the topic of openFile. It's reading from my CD fine now using;
open the moviePath & ("subfolder\setup.exe") -- and also the suggested "notepad.exe"
However when I ask it to load up another file in the same folder, it doesn't work. tested files include:
Any idea why it would like these files, but it's fine openning published files and notepad.exe?
Thanks for all the help.
The open command can ONLY open .exe files. It will always fail with
inf, htm, or jpg files. It only opens executables. I don't know why it
failed to open your autorun.exe file. Are you sure that it didn't?
Does that autorun.exe file need to be fed some sort of command line
switch in order to do what it is meant to? Perhaps it did open, but
then shut down real quick because it wasn't given the correct input.
Does it do anything if you just doubleclick on that file in Explorer?
Your right, it doesn't appear to do anything the autorun.exe...
...infact> an autorun.inf launches autorun.exe which appears to launch index.htm. However, if you simply launch autorun.exe it does nothing...
back to the point, yes, your totally right. Now my next question would be the grand finalie. What operation should I use to open an non-executable file.
I've already looked at the methods, but 'open' looked just right. Which one should I use a .htm file?
Director can't do that on its own. Actually it can with open..with, but
that is generally a lot more effort than it's worth. I would use the
BuddyAPI xtra (www.mods.com.au/budapi). There is a command called
baOpenFile which will let you open any file using the program associated
with it. Thus, you can open that htm file in IE (or firefox or whatever
the user has set as the default browser)
Open by itself will only start up an executable file. You can use open
"fileName" with "application" to open a file. The catch is that you have
to know the full path to the app that will open the file.
For .html docs its simple, usually. You can just use:
open "whatever.html" with browserName()
browserName() is a Lingo function that will return the path to the
user's default browser.
If you are relying on an app that you expect the user to have installed,
then the best action is to use buddyAPI to find the app for you. Once
you find the app, you can use its path to open your file.
Adobe Community Expert
Strangely, I was at the browserName() syntax, but it didn't occur for me to use it. I was trying;
gotoNetPage moviePath&"myPage.html" -- which didn't work.
However when I try;
open moviePath&"subfolder\whatever.html" with browserName()
again, it doesn't like it. How do it point it in the right direction into my subfolder? Otherwise, IE tries to open: " http://dvr400p/index.htm"
> Strangely, I was at the browserName() syntax, but it didn't occur for
> me to use it. I was trying;
> gotoNetPage moviePath&"myPage.html" -- which didn't work.
> However when I try;
> open moviePath&"subfolder\whatever.html" with browserName()
> again, it doesn't like it. How do it point it in the right direction
> into my subfolder? Otherwise, IE tries to open:
> " http://dvr400p/index.htm"
open (quote & "file:///" & the moviePath & "subfolder\whatever.html" &
quote) with browserName()
n.b. the "the" in front of "the moviePath".
The "open" command is not reliable. BrowserName() is not reliable (at least
not on Macs). Judge for yourself whether you'd prefer to use the reliable
Thanks Andrew. I tried your method, but to no avail. I thought I saw an error in your script;
open (quote & "file:///" & the moviePath & "DVR400N\software.htm" & quote) with browserName()
my addition changing the quote:
open (quote & "file:///" & quote & the moviePath & "DVR400N\software.htm") with browserName()
However neither worked. I'm slightly reserved about using baOpenFile, unless its quite simple to use? Can someone shed a little light on either the baOpenFile or Andrews script above?
Thanks for everyones help so far :)
> Thanks Andrew. I tried your method, but to no avail.
What's happening/not happening?
> I thought I saw
> an error in your script;
> open (quote & "file:///" & the moviePath & "DVR400N\software.htm" &
> quote) with browserName()
> my addition changing the quote:
> open (quote & "file:///" & quote & the moviePath &
> "DVR400N\software.htm") with browserName()
No, that would be wrong because I was putting double-quotes around the
entire URL (which uses the file:/// pseudo-protocol). The open command
cannot cope with paths/filenames with spaces; it was possible that was
messing it up for you. Also, it can't cope if there are more than 127
> However neither worked. I'm slightly reserved about using baOpenFile,
> unless its quite simple to use?
err=baOpenFile(the moviePath & "DVR400N\software.htm", "normal")
if err < 32 then
alert("BuddyAPI error number " & string(err))
So it'll let you know what didn't work. There's a list of what the error
numbers mean in the buddyAPI docs, or I wrote a handler to translate it to
So you script is just a query? I would actually need to run a operation to get IE to launch?
I was under the influence buddyAPI is a 3rd party application. If so, does it work closely with director? Being in my early days of Director, I wanted to avoid to much complexity.
I think I'll look into it in the morning.
BuddyAPI is a plugin for Director (known as an xtra). It works superbly
well with Director, as that is what it is made for. You can download it
for free at www.mods.com.au/budapi. The documentation that it comes
with is very complete and easy to follow, and I advise reading through
it. Anyway, once you install it (by copying it into your
Director/configuration/xtras folder), you can just use the extra lingo
commands that it offers. The one in question here, baOpenFile, will (as
its name implies) open a file. It is a single line of code (and a few
extra lines for error checking).
It is free to use up to 2 functions in any projector. If you want to
use >2 then you need to buy it. It is well worth the money! In this
case, you are only using one command (even if you use it multiple
times), so it would be totally free.