-
AS3 + Javascript communication
Hello,
So basically, I have a javascript array and a function on my html page, and I need actionscript to be able to pick the right one from the array and run the function based on what button I pushed.
My javascript is:
Code:
<script>
navArray = new Array();
navArray["home"] = "../index.aspx";
navArray["about"] = "../about.aspx";
navArray["contact"] = "../contact.aspx";
navArray["services"] = "../services.aspx";
navArray["mediainterface"] = "../mediainterface/";
navArray["photogallery"] = "../photogallery/";
function navigate(which) {
if (window.opener) {
if (which == "contact" || which == "services")
{
window.open (navArray[which], 'newWin')
}
else if (which == "photogallery" || which == "mediainterface")
{
window.location = (navArray[which]);
}
else
{
window.opener.location = navArray[which];
opener.window.focus();
}
}
else
{
window.location = (navArray[which]);
}
}
</script>
I'm a little lost on the AS part of it, what would be the best way to have the each different button run it's respective part in the JS array/function?
Thanks
-
PHP Code:
ExternalInterface.call('navArray', 'photogallery');
-
Hmm, it's not doing anything,
I imported the external interface class
Code:
import flash.external.ExternalInterface;
and other things work with it. Am I missing something?
-
Whoops - that should be targetting "navigate" not "navArray" - first param is the function, after that it's arguments you want to pass.
-
Awesome that worked. Thanks!
-
I Love India
hi. I want the source sample of ur code.. i too tried the same but it seems not working for me...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|