Vince Lowe
Vince Lowe

Reputation: 3630

Flex get iframe text value

I am using an iframe layered over my flex application. In my iframe i have a text input with the id of 'days' which is read only.

How can i read the value of days in my flex app?

I thought i may need to do something like this?

var d = ExternalInterface.call("top.frames[0].document.getElementById('days').value");

but it didn't work.

Upvotes: 0

Views: 444

Answers (1)

freakish
freakish

Reputation: 56587

It doesn't work, because top.frames[0].document.getElementById('days').value is not a function, it's a property. You need to pass function to ExternalInterface.call (more precisely the name of a function). For example, you can define in JavaScript (main window)

top.GetValue = function(id) {
    return frames[0].document.getElementById(id).value;
}

and then use

var d = ExternalInterface.call('top.GetValue', 'days');

in ActionScript.

Upvotes: 1

Related Questions