Solved

Calling Flash function from Director

Posted on 2011-03-08
8
779 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
 

Author Comment

by:jasonb2
ID: 35088861
Hi Chris,

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

0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now