Kircho Grozdanov
Kircho Grozdanov

Reputation: 3

calling JavaScript in AS3

So i have this expandable banner. And everything is ok with it, but when i'm testing it on our system it's not expanding. And here is the problem. Because our system is using this JavaScript for the floating : getURL("javascript:expandEaFloating('"+_level0.id+"')"); But this is AS2 and i need it for AS3. Here is the code:

import flash.external.ExternalInterface;
import flash.events.Event;
stop();


b1_btn.buttonMode = true;

b1_btn.addEventListener(MouseEvent.MOUSE_OVER, aBanner2);
b1_btn.addEventListener(MouseEvent.MOUSE_OVER, openBaner);


function openBaner(e:Event){  
    ExternalInterface.call("expandEaFloating('"+root.id+"')");
}

function aBanner2(e:Event){
this.gotoAndStop(2);
}

Upvotes: 0

Views: 237

Answers (2)

Larusso
Larusso

Reputation: 1151

Instead of root.id use ExternalInterface.objectID

ExternalInterface.call("expandEaFloating",ExternalInterface.objectID);

From the adobe docs:

Returns the id attribute of the object tag in Internet Explorer, or the name attribute of the embed tag in Netscape.

So be shure to set id and name of the object tag to the same value!

Upvotes: 0

Tiago Peczenyj
Tiago Peczenyj

Reputation: 4623

try this:

ExternalInterface.call("expandEaFloating",root.id);

Upvotes: 1

Related Questions