Go Back   kirupaForum > Flash > Flash IDE

Reply
 
Thread Tools Display Modes
Old 12-21-2009, 05:21 AM   #1
rajesh_flash
Registered User
Communication between AS 1.0 and AS 3.0

Hello Friends,

I am having a small doubt in flash. It was a communication problem between flash cs3 and flash mx 2004.

I am using flash cs3, I am loading an external swf file into my application(the loaded file is in mx2004 format, in which I have a button). Now on clicking on that button i want to call a method which is there inside flash cs3.

How to do this ? can anyone answer my ques asap. Its very urgent


Regards,
Rajesh
rajesh_flash is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?

Old 12-21-2009, 06:05 AM   #2
Swooter
Swooter - AS/JS/HTML/CSS
 
Swooter's Avatar
use the LocalConnection class... although, I don't know whether it's available in AS1

Example AS3:
Code:
var $lc:LocalConnection = new LocalConnection();
var $lcClient:Object = {};
$lc.allowDomain("*");
$lc.connect("_example"); // mind the underscore
$lc.client = $lcClient;

// Receive from AS1 to AS3
$lcClient.someAS3Function = function($message:String):void {
  trace("AS1 to AS3: " + $message);
}
 
// Send from AS3 to AS1
myButton.addEventListener(MouseEvent.CLICK, function(e):void {
  $lc.send("_example", "someAS1Function", "hello world! I am AS3");
}
Example AS1:
Code:
var $lc = new LocalConnection();
$lc.allowDomain("*");
$lc.connect("_example");
 
$lc.someAS1Function = function($message) {
  trace("AS3 to AS1: " + $message);
}
 
myButton.onRelease = function() {
  $lc.send("_example", "someAS3Function", "hello world! I am AS1");
}

__________________

AS / JS / HTML / CSS / PHP
Swooter is offline   Reply With Quote
Old 12-21-2009, 08:13 AM   #3
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,784
Quote:
Originally Posted by Swooter View Post
use the LocalConnection class... although, I don't know whether it's available in AS1
AS1 should be fine but localConnection will only work in FP6 or higher. Can't see that being a problem here though as an AS3 SWF would be targeting FP9 at least.

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
glosrfc is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:24 AM.

SHARE:

SUPPORTERS:

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com