Passing variable from haxe generated swf to parent swf using local connection

57 views
Skip to first unread message

PATurmel

unread,
May 20, 2014, 6:58:59 PM5/20/14
to haxe...@googlegroups.com
Just starting to use haxe to see if it will be practical, I will need to pass variables to the parent swf (flash file) from the haxe generated swf.

This is the code I have now

package;


import flash.net.URLVariables;


 
class Test2a
{


 
static function main()
 
{
 
var funanal = function() {
 
 conn
.send('analconnect', 'analHere', analstring);
 
 
}//  funanal()
 


 analstring
= "Drag 3D";
 funanal
();
 
 
 
}//  static function main()
 
}//  class Test

The error is somewhere in   conn.send('analconnect', 'analHere', analstring);

PATurmel

unread,
May 21, 2014, 7:39:20 PM5/21/14
to haxe...@googlegroups.com
The best solution I've come up with is to write an XML file, throw it up on a server using a php file and load the XML with the parent swf.

Confidant

unread,
May 22, 2014, 1:29:41 PM5/22/14
to haxe...@googlegroups.com
If I'm understanding your problem correctly, it may be simplest to do one of the following:
  • Declare a public variable in the child swf. If the parent swf has a reference to the child called "childMC", then you could access it like "childMC.theVariable"
  • Create a custom event in the child which includes data. Add a listener from the parent. There is an example here of how to do that in Actionscript 3, which is very similar to Haxe.

Confidant

unread,
May 22, 2014, 1:31:41 PM5/22/14
to haxe...@googlegroups.com
LocalConnection is generally used when there are two swf files in the same environment, like a webpage, and neither is the "parent" or the "child".
Reply all
Reply to author
Forward
0 new messages