3

I am a little new to flash and ActionScript and I have this persistent problem with security I think.

The problem is that. I try to use code for a button in ActionScript 2.0 (i must use 2.0)

on(rollOver)
{
    getURL("javascript:someFunction();","_self");
}

This code is supposed to work, it worked for other people =)

Before you say that i am placing it in some wrong place. I place it in the button. Moreover it does work fine, when i try the movie in Flash CS5, using CTRL + ENTER. But when i embed my .swf I get a message something like

the aplication is trying to access page...see parameters for flash player

Sorry for a bad translation.

I also tried this code:

on(rollOver)
    {
        getURL("http://www.something.com","_self");
    }

and it worked.

the embed code:

        <object width="100%" height="60">
                <PARAM NAME="quality" VALUE="high">
                <PARAM NAME="wmode" VALUE="opaque" >
                <PARAM name="AllowScriptAccess" VALUE="always" >
                <EMBED src="small.swf" width="100%" height="60" wmode="opaque" quality="high" AllowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
                </EMBED>
                <noembed></noembed>
        </OBJECT>

I should add, that I don't have any power over where the swf file is going to be hosted or anuthing of the sort. It really is not my swf file. All i can do is manipulate it via JAVASCRIPT and for that, I need to get the exact code to work.

bpeterson76
  • 12,918
  • 5
  • 49
  • 82
Olga
  • 1,648
  • 1
  • 22
  • 31
  • 1
    You'd need a crossdomain.xml file on your server to allow flash scripts to access www.something.com. Flash has a default same-origin security policy and won't talk to "other" servers until it's explicitly allowed to via that .xml file. – Marc B Jun 27 '11 at 15:14
  • oh but it does acces something.com/ it does not acces javascript:alert("hello world"); – Olga Jun 27 '11 at 15:16

2 Answers2

3

if you want to call the JavaScript function from the ActionScript Code. you can use the ExternalInterface API which provided in the ActionScript. Please check the Flash Help you will find out the proper example of the Code for ExternalInterface.

Mrugesh
  • 461
  • 4
  • 16
0

I think the problem is simillar to this http://board.flashkit.com/board/archive/index.php/t-652586.html

As I know, the problem happens only when SWF is loaded from local folder. Try to put it on webserver and crossdomain issue should disappear.

Lehych
  • 166
  • 1
  • 12
  • this worked =) thanks...I'll try to investigate further now, to try and understand the cause – Olga Jun 27 '11 at 18:25