GroupBrowser  




Go Back   GroupBrowser > Macromedia Newsgroups > Macromedia Director > Director Lingo
User Name
Password
 
 
Thread Tools Search this Thread Display Modes

sending flash variables
Old 08-24-2008, 03:06 PM #1
farazfo
Guest
 
Status:
Posts: n/a
Default sending flash variables

I have imported a flash file inside director...
how can I access the variables which I used in the flash, through director?
how can I send the variables from flash movie to the director?
I used this command in the flash movie on a button:
on (release) {
getURL("event: FlashMouseEnter, \"hi\"");
}
but I could not send variables with this command! only the strings
what should I do about variables?

  Reply With Quote

Re: sending flash variables
Old 08-27-2008, 06:30 AM #2
pete.h
Guest
 
Status:
Posts: n/a
Default Re: sending flash variables

This is how I do it (this is from my memory, so I haven't tested this exact
code):
--------------------------------------------
ACTIONSCRIPT :
//(At the start of your script)
// set up the listener that passes the event and variables to Director...
var directorListener:Object = new Object();
directorListener.handlerName = function(evt_obj:Object):Void { }

//(At the end of the first frame of you script)
if (System.capabilities.playerType == "DirectorXtra") {
getURL("event:flashLoaded"); // Director can now do stuff with the flash
object!
} else {
// commands to test swf outside of Director go here...
}

--------------------------------------------
LINGO:
on flashLoaded me
//set up an intercept of any calls to the directorListener function...
sp=sprite(spriteNum)
listener=sp.directorListener
sp.setCallBack(listener, "handlerName", #lingoHandler, me)
end

on lingoHandler me,directorListener,flashVariables
put flashVariables.type
put flashVariables.target._x
put flashVariables.selectedIndex
end
--------------------------------------------
Then, back in ACTIONSCRIPT, to pass Flash variables, not string values, use
this code:
--------------------------------------------
//call the function in the directorListener event
directorListener.handlerName ({type:"select", target:this, selectedIndex:23});
//the props in the assoc. array can be anything! Add as many as you need.

For more on Flash<->Director variable passing and events, see

http://www.adobe.com/cfusion/webfor...mid=11&catid=18
7&threadid=1382714&enterthread=y

  Reply With Quote

Re: sending flash variables
Old 08-28-2008, 05:40 AM #3
farazfo
Guest
 
Status:
Posts: n/a
Default Re: sending flash variables

thank you veryyyy much :)
one more question
now I know how to call a function and send variables to director through flash
but how can I call a function that I've written in flash through director?
  Reply With Quote

Re: sending flash variables
Old 08-28-2008, 05:48 AM #4
pete.h
Guest
 
Status:
Posts: n/a
Default Re: sending flash variables

farazfo: That's the wonderfully simple part....

ACTIONSCRIPT:

function myFlashFunction(someNumber){ //code goes here}

To call it in Lingo, just use:

sprite(spriteNum).myFlashFunction(5)

Also, see the posts above for examples of passing Lists by converting to
Arrays.


  Reply With Quote
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes





Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump




Adobe Newsgroups | Software Newsgroups


Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2003-2004 All Rights Reserved GroupBrowser LLC.