AS bridge comunicating AS2 and AS3

I think someone who are good in AS can help me in very short time, maby this is look like big text but it is not.
My problem is:

  • I have two buttons, one in AS2 and the other one in AS3 window.
  • Buttons doing different job.
  • Is it possibile when i click on button in AS2 to do also what button in AS3 doing.?
  • Mean: Separately both button work fine. I want when click in AS2 button both event to start, if you understand what i’m saying.
    I don’t know how to do that, i am not good as you.
    Can you please help me?

Now better explanation:

This is a code I used in AS3 file from this adress:
http://blog.crondesign.com/2009/10/s...43047582176214

[COLOR=blue]AS3 code:[/COLOR]


import com.adobe.images.JPGEncoder;
import nl.stroep.utils.*;
import com.gskinner.utils.SWFBridgeAS3;

//SETUP::::::::::::::::
loadingsign.visible=false
var scriptURL="http://www.artbata.com/"; //absolute path to directory containing savePNG.php on your server
var savePath="Dnevne_sobe"; // save filename excluding .png file extension (relative path from scriptURL)
var scriptName="savePNG.php"
var AS2swf="dnevne_sobe.swf"

///////////////////////
//LOAD THE AS2 swf:
loadingsign.visible=false
var loadit = new Loader();
loadit.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
addChild(loadit);
loadit.load(new URLRequest(AS2swf)); //the name of your AS2 swf
//when swf has loaded:
function onLoadComplete(evt:Event):void {
    //move print button and loading sign above imported swf:
    setChildIndex(goBTN, numChildren-1);
    setChildIndex(loadingsign, numChildren-1);
    trace('AS2 LOADED')
}

///SET UP A BRIGE TO AS2:
var myBridge:SWFBridgeAS3 = new SWFBridgeAS3("connectionID", this);

/*
//WHEN THE CONNECTION IS ESTABLISHED: (optional)
myBridge.addEventListener(Event.CONNECT, handleConnect);
function handleConnect(event:Event){
    //setupSWF is an example how to call an AS2 custom function:
    myBridge.send("setupSWF","parameter1");
};
*/

//PRINT BUTTON ACTION:
goBTN.addEventListener(MouseEvent.MOUSE_UP, goBTNclick);
function goBTNclick(event:Event){
    loadingsign.visible=true
    goPrint(112,1,867,530)
}

//CREATE AND EXPORT THE JPGS TO PHP:
function goPrint(X:Number,Y:Number,W:Number,H:Number){
    var thecrop = crop( stage,W,H,X,Y);
    var imageSaver:ImageSaver = new ImageSaver( scriptURL+scriptName );
    imageSaver.save ( thecrop, savePath ); 
    imageSaver.addEventListener ( Event.COMPLETE,onSaveComplete)
    imageSaver.addEventListener ( IOErrorEvent.IO_ERROR, onSaveError );
    trace('PRINTING: '+X+', '+Y+', '+W+', '+H+" to:
"+scriptURL+savePath+'.png');
}
function onSaveComplete(e){
    trace('SAVE COMPLETE')
    loadingsign.visible=false
}
function onSaveError(e){
    trace('ERROR WITH SAVE')
    loadingsign.visible=false
}

/////////////////////
//FUNCTIONS::::::::::
function crop( inDisplayObject:DisplayObject, inWidth:Number = 550, inHeight:Number = 400, inX:Number = 0, inY:Number = 0, inScale:Number = 1):Bitmap{
    if (!inDisplayObject) { throw new Error('CropUtil.crop > needs a something on the display list'); return null; }
    var cropArea:Rectangle = new Rectangle( 0, 0, inWidth * inScale, inHeight * inScale);
    var croppedBitmap:Bitmap = new Bitmap( new BitmapData( inWidth * inScale, inHeight * inScale), PixelSnapping.ALWAYS, true );
    croppedBitmap.bitmapData.draw( inDisplayObject, new Matrix(inScale, 0, 0, inScale, -inX, -inY), null, null, cropArea, true );
    return croppedBitmap;
}

[COLOR=blue]

AS2 code:[/COLOR]


//AS2-3 bridge: 
import com.gskinner.utils.SWFBridgeAS2; 
var myBridge:SWFBridgeAS2 = new SWFBridgeAS2("connectionID", this);

goBTN is name of the instance in AS3 file. When I click in the that button picture is saved on the server.

My problem is I want to have a button in AS2 file, and when i click on that button to do action like AS3 button.

I’m trying this for a long time and couldn’t make it to work.
Can somebody help me. Here is the link i found closer to problem:
http://gskinner.com/blog/archives/20...dge_easie.html

Everything can stay the same. AS3 file and AS2 file. Everything works fine.
I just need to add function to button in AS2 file to do the same thing like goBTN in AS3 doing.

I am tryed
goBTN.onRelease=function(){
myBridge.send(“goBTNclick”,“goPrint”,“crop”);
}
Aslo as guide is i added go BTM in AS2 first frame.
But this is not working.