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
SecureNet Xtra
FreePPP Control
Narration Tool
Amara Flash Intro and Banner Builder
Video Ghosting
Res Mode
Drag To View
CatFlip
Copy matching Pixels
Open File with associated extension.
 

 

 

Xtra ControlXtra

Added on 2/1/2007

 

Compatibilities:
behavior D6_5 D7 D8 D8_5 D9 PC US

This item has not yet been rated

Author: kfink (website)

This FREE xtra adds spell checking with suggestions to director as well as UDP / TCP and USB HID support. Other features include a FindAndReplace in a string and returning a list of size x of prime numbers. I continue to add new features everyday, check out the website for more info!

Price: $0
Mediamacros makes no guarantees that this price is correct

Get the Xtra
-----------------------------------------------------------------------------
Control Xtra
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
ABOUT
-----------------------------------------------------------------------------

Created by Kevin Richard Fink
January 22nd 2007

This is a work in progress xtra, as such some features are not yet fully
operational.  Here is the current status of each call:


Complete features: (stable)

SendUDPMessage(ip, port, msg) -- Sends a string over UDP

SendTCPMessage(ip, port, msg) -- Sends a string over TCP

HasNext() -- Returns true if their are any messages received from UDP,
TCP or HID USB

GetNext() -- Returns the next message in the queue received from UDP,
TCP or HID USB

DestroyAllThreads() -- Stops all UDP, TCP, and HID communications

GetListOfPrimes(numPrimes) -- Returns a list of primes of specified
size.

GetListOfDevices() -- Returns a list of every device connected to
the computer.



Beta features: (unstable)

WaitForUDP(port) -- Waits for a connection on TCP,  DO NOT RUN TWO
THREADS ON THE SAME PORT EVER!

WaitForTCP(port) -- Waits for a connection on TCP,  DO NOT RUN TWO
THREADS ON THE SAME PORT EVER!

GetListOfHIDDevices() -- Returns the VendorID, VersionNumber and
ProductID of all HID devices connected to your computer.

CheckWord(Word) -- Returns true if the word is spelled correctly

GetSuggestions(word) -- Returns a list of words closely matching
the specified word.

FindAndReplace(word, lookFor, replaceWith) -- Replaces a part of a
string in a string with another string.  Returns the result.

SendFile(IP, port, Filename) -- Sends a file to a waiting client

WaitForFile(port, Filename) -- Receives a file stores it as filename

isDone() -- Returns true if their are no active file transfers


Alpha features: (Untested) -- Avoid using these

SendDataToHIDDevice(Message) -- sends a message up to 64kbytes to
the first active USB device... avoid multiple USB connections on the same
xtra object. Returns -1 if you did not create a USB connection.

InitGetDataFromHIDDevice( vendorID, ProductID, VersionNumber) --
Creates a communication for the specified USB device



Please report any bugs to:

Kevin Fink
kfink@nvisionstudio.com
519-868-3649


-----------------------------------------------------------------------------
INSTALLATION
-----------------------------------------------------------------------------

Simply copy "ControlXtra.x32" to your xtras directory off of your
Director Installation.


-----------------------------------------------------------------------------
HOW TO USE
-----------------------------------------------------------------------------

There are six basic procedures you need to know about:


-----------------------------------------------------------------------------
WaitForUDP (Object me, Integer PortNumber)

DESCRIPTION:

This function creates a thread that looks for UDP messages on the
requested port.

USAGE:
object = new(xtra "ControlXtra")
object.WaitForUDP( 1627 )

NOTE:
To retrieve messages you will have to use getNext() and
hasNext().
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
WaitForTCP (Object me, Integer PortNumber)

DESCRIPTION:

This function creates a thread that looks for TCP messages on the
requested port.

USAGE:
object = new(xtra "ControlXtra")
object.WaitForUDP( 1627 )

NOTE:
To retrieve messages you will have to use getNext() and
hasNext().
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
SendUDPMessage (Object me, String IP, Integer PortNumber, String Message)

DESCRIPTION:

This function sends a UDP packet containing your message to the
specified port

USAGE:
object = new(xtra "ControlXtra")
object.sendUDPMessage("192.168.0.100", 1627, "MY MESSAGE")
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
SendTCPMessage (Object me, String IP, Integer PortNumber, String Message)

DESCRIPTION:

This function sends a TCP packet containing your message to the
specified port

USAGE:
object = new(xtra "ControlXtra")
object.sendTCPMessage("192.168.0.100", 1627, "MY MESSAGE")
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
HasNext (Object me)

DESCRIPTION:

This function returns true if their are messages that have not yet
been processed.

USAGE:
on startMovie
global object
object = new(xtra "ControlXtra")
object.waitForUDP(1627)
object.sendUDPMessage("192.168.0.100", 1627, "HERE IS A SAMPLE MESSAGE")
end

on enterFrame me
global object
if object.hasNext() then
alert "THERE IS A NEW MESSAGE!!"
end if
end
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
GetNext (Object me)

DESCRIPTION:

This function returns any messages that have not yet been sent to
director, or -1 if their is no messages.

USAGE:
on startMovie
global object
object = new(xtra "ControlXtra")
object.waitForUDP(1627)
object.sendUDPMessage("192.168.0.100", 1627, "HERE IS A SAMPLE MESSAGE")
end

on enterFrame me
global object
if object.hasNext() then
alert object.getNext()
end if
end
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
DestroyAllThreads (Object me)

DESCRIPTION:

Basically a closing parameter in this application, it ensures that the memory is
cleaned of any remaining unread messages and closes all open ports that it was using.

USAGE:
on startMovie
global object
object = new(xtra "ControlXtra")
object.waitForUDP(1627)
object.sendUDPMessage("192.168.0.100", 1627, "HERE IS A SAMPLE MESSAGE")
end

on enterFrame me
global object
if object.hasNext() then
alert object.getNext()
end if
end

on StopMovie
global object
if object <> void then
object.DestroyAllThreads()
end if
end
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
GetListOfPrimes (Object me)

DESCRIPTION:

Returns a list containing the number of prime numbers specified

USAGE:

object = new(xtra "ControlXtra")
put object.getListOfPrimes(100)

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
GetListOfDevices (Object me)

DESCRIPTION:

Returns a list containing all devices connected to the pc.

USAGE:

object = new(xtra "ControlXtra")
put object.getListOfDevices()

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
GetListOfHIDDevices (Object me)

DESCRIPTION:

Returns a list containing all connected HID devices connected to the pc.
Each entry of the list consists of a versionID, versionNumber and a productID

USAGE:

object = new(xtra "ControlXtra")
put object.getListOfHIDDevices()

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
SendDataToHIDDevices (Object me, String Message)

DESCRIPTION:

Sends a message to a connected HID device.  Extremely unstable.

USAGE:

object = new(xtra "ControlXtra")
put object.sendDataToHIDDevices("Message")

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
InitGetDataFromHIDDevice (Object me, Integer vendorID, Integer productID, Integer versionNumber)

DESCRIPTION:

Starts a thread to get all incoming data from the specified USB device... 0 for any
value becomes a wildcard.  Be as specific as possible to connect to the right device.
Extremely unstable.


USAGE:

object = new(xtra "ControlXtra")
put object.InitGetDataFromHIDDevice(vendorID, productID, versionNumber)

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
checkWord (Object me, String word)

DESCRIPTION:

Returns true if the word is spelled correctly, false if it is not.


USAGE:

object = new(xtra "ControlXtra")
put object.checkWord("test")

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
getSuggestions (Object me, String word)

DESCRIPTION:

Returns a list of strings closely matching the word specified


USAGE:

object = new(xtra "ControlXtra")
if object.checkWord("testz") then
alert object.getSuggestions("testz")
end if

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
findAndReplace (Object me, String word, String lookFor, String replaceWith)

DESCRIPTION:

Replaces a string within a string with the specified string.


USAGE:

object = new(xtra "ControlXtra")
alert output.findAndReplace("Testing", "tin", "lg")

outputs:
"Teslgg"

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
SendFile (Object me, String IP, Integer Port, String Filename)

DESCRIPTION:

Sends a file over TCP


USAGE:

object = new(xtra "ControlXtra")
output.SendFile("192.168.0.1",1222,"C:input")

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
WaitForFile (Object me, Integer Port, String Filename)

DESCRIPTION:

Retrieves a file from TCP (initialize this before you send a file)


USAGE:

object = new(xtra "ControlXtra")
output.SendFile(1222,"C:output")

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
IsDone (Object me)

DESCRIPTION:

Returns true if their are no active file connection.

USAGE:

object = new(xtra "ControlXtra")
put object.isDone()
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
NOT-AS-OF-YET-FREQUENTLY-ASKED-QUESTIONS
-----------------------------------------------------------------------------

WHAT DOES IT COST?:

Its free, and will remain free.



WILL THE SOURCE CODE BE PROVIDED?:

No, but if you would like modifications, contact me and we can work
something out.



WHAT DOES MULTITHREADED MEAN IN TERMS OF THIS XTRA?:

Well for one, if you have multiple cores or cpus this application will
make work for them to do.  The threading comes in the server portion of it,
each time you call WaitForUDP(port) you create a new thread that exclusively
handles incoming messages on that port.  There is also a main thread that
handles calles for messages and sending messages, all other procedures share
one thread.



WHY CREATE THIS XTRA? CAN'T YOU USE MULTIUSER XTRA INSTEAD?

Macromedia/Adobe no longer supports the MULTIUSER XTRA.  In short,
its a horribly unfinished and confusing mess of an xtra.  If you've had the
displeasure of using that Xtra you will understand.  There are also many
limitations on it, expecially with peer-2-peer connections.  Limitations
include no UDP support for P2P, limit of 8 connections on P2P and finally
an ugly discontinued server app that they charge for.  Self discovery is
impossible using MULTIUSER server, it can take sever seconds to try to
establish a connection with a single IP, and has absolutely no threading,
essentially you have to go at it one IP at a time.


IS IT SHOCKWAVE-SAFE ?

No, but I could provide a copy that is.  Contact me if your interested!
I'm essentially holding back for more testing to ensure it will not produce any
exploits.


WHAT IS SELF-DISCOVERY?

Although not a specific function in this xtra, it makes it
possible!  If your on a network and want to establish a connection with
another client that you don't have the address for.  With this you can use
director to write your own self-discovery algorithm but here is the general
idea.

Find out your networks subet mask:
ex 255.255.255.0

Find out your IP
ex 192.168.0.1

Using the subnet mask and your IP, you know that clients will be in the
range.  (ex from above) 192.168.0.0 to 192.168.0.255

Simply create a message with your location and send it to all other
clients in that range.  ex "192.168.0.1 REQUEST_CONNECTION"

You also want to scan for messages with the "REQUEST_CONNECTION" add the
IP from that REQUEST, then send your IP and all the other clients you have
with the same message.  Very quickly you will find all the clients on the
network.

 


Contact

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

Send e-mail