PDA

View Full Version : AS ExternalInterface buttons


walius100
08-27-2009, 12:49 PM
Hello, here is my problem:

I have AS2 flash file, some kind like menu, and I'm using flash.external.ExternalInterface to call javascript functions on my site. I added this code to my AS layer:

stop();
import flash.external.ExternalInterface;

function one() {
ExternalInterface.call("one");
}
vienas.addEventListener("click", one);


button name is "vienas" and in my HTML I have JS function "one" this function simply loads some data in iframe tag.

all seems to be OK but it only works when I use button from flash components (the default white, rounded button)

AS doesn't calls JS when I use my own button (like text or simple box as button)
All I need is a custom button, which can call JS function.

It only works with button from flash components.




Maybe anyone have suggestions?
Thanks.

tadster
08-29-2009, 05:25 PM
that's odd.

If you make a custom button and name it 'vienas' it should work..

walius100
08-31-2009, 07:15 AM
OK, I've found where is the truth:

it works with this code

stop();
import flash.external.ExternalInterface;

vienas.onRelease = function() {
ExternalInterface.call("one");
}

I do not know why I must use this method of calling event, but now it is working with custom made buttons as with from components library.