?
Solved

Calling Flash function from Director

Posted on 2011-03-08
8
Medium Priority
?
811 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
Technology Partners: 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 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
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 Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
Suggested Courses
Course of the Month16 days, 20 hours left to enroll

864 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