Solved

Calling Flash function from Director

Posted on 2011-03-08
8
793 Views
Last Modified: 2013-12-20
I'm using ActionScript3, FLash CS5 and Director 11.5.

I have a Director app with a Flash component in it.
I want to be able to call a function in my Flash component from my Director code.

I can call a function in Director from my Flash component using "NavigateToUrl" function.
Is there something that easy from Director to Flash?

Also, can i pass variables from Director to Flash?

With Thanks
0
Comment
Question by:jasonb2
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Expert Comment

by:nycynik
ID: 35086945
As far as I know, the answer is no.

This is the way to do it if you embed it in HTML.

<object ...>
<param name=movie value="Flash/test.swf?x=123">
<embed src="Flash/test.swf?x=123"...></embed>
</object>

Open in new window


then use it in flash like this:
myURL = this._url;
myPos = myURL.lastIndexOf("?");
myParam = myURL.substring(myPos,myURL.length);
//this returns the querystring elements - you can now split these using split	

Open in new window

from http://www.actionscript.org/forums/showthread.php3?t=10586
0
 
LVL 2

Expert Comment

by:nycynik
ID: 35086972
I wanted to include one more link, this is from adobe

http://kb2.adobe.com/cps/142/tn_14253.html
0
 
LVL 7

Expert Comment

by:Chris-Chambers
ID: 35088308
Hi,

Yes you can, is your Director app running in a browser or as an .exe app?

Chris.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jasonb2
ID: 35088861
Hi Chris,

We have two versions - One runs in a browser, the other as an exe.

0
 
LVL 7

Expert Comment

by:Chris-Chambers
ID: 35089130
Hi,

I do this all the time in exe apps, I've not tested in a browser, but I would think it should work the same.

If you have a function in Flash eg:

function setIconScale(x_pos:Number, y_pos:Number) {

// Do something

}

You can call it from Director by saying:

sprite("NameOfYourFlashSprite").setIconScale(_mouse.mouseH, _mouse.mouseV)

Easy as that.

Hope this helps,

Chris.
0
 

Author Comment

by:jasonb2
ID: 35089341
Unfortunately your method works with AS2 but not with AS3.
0
 
LVL 7

Expert Comment

by:Chris-Chambers
ID: 35098529
Yes I am using AS2. Why has that broke??

Could you compile in AS2 by any chance?

Chris.
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 125 total points
ID: 35150856
I haven't used Director since version 8 so i did some googling.

http://groups.google.com/group/macromedia.director.basics/browse_thread/thread/85203d2879267fe1?pli=1

if you're still using version 11 then i'm guessing what was mentioned there still holds true
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question