Solved

Calling Flash function from Director

Posted on 2011-03-08
8
782 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

777 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