PDA

View Full Version : How to call multiple getURL?


nmduc073
11-18-2008, 03:01 AM
I have this piece of code:
on (release) {
getURL("javascript:jsABC()");
getURL("http://www.google.com");
}
However, it can't call the first getURL. Is there any way to call them in a single getURL, please?

atomic
11-18-2008, 04:49 AM
Have you tried the first on an on(press) handler and the second on the on(release) handler?

Have you tried opening the second from within the first javascript function itself?

nmduc073
11-18-2008, 06:03 AM
Thank for your suggestion. I will try to put one in press event.

I am afraid that we can redirect to other HTML page in javascript.

nmduc073
11-18-2008, 06:06 AM
And I have another issue. When I can't work with getURL, I used ExternalInterface.
import flash.external.*;

_root.onRelease = function()
{
flash.external.ExternalInterface.call("alert", "abc");
}

However, it didn't work in IE and FF. I don't know the reason. I copied an ExternalInterface example and it worked. However, there was no alert when I run aove code.

atomic
11-18-2008, 06:09 AM
:confused:

flywithoutwings
11-18-2008, 06:20 AM
And I have another issue. When I can't work with getURL, I used ExternalInterface.
import flash.external.*;

_root.onRelease = function()
{
flash.external.ExternalInterface.call("alert", "abc");
}

However, it didn't work in IE and FF. I don't know the reason. I copied an ExternalInterface example and it worked. However, there was no alert when I run aove code.

try _root.onMouseDown instead of _root.onRelease...i guess onRelease for root wont work fif document is empty as there will be no hit area for empty document.

nmduc073
11-18-2008, 06:41 AM
Here is my new code:
on (press) {
_root.getURL("javascript:jsABC()");
}

on (release) {
_root.getURL("http://www.google.com");
}

In FF, it displayed alert and redirected to google. In IE, it only showed alert form. T_T

atomic
11-18-2008, 06:58 AM
You could maybe try a setTimeout...

nmduc073
11-18-2008, 07:05 AM
Please tell me how to set timeout? And it for what? I am newbie.

nmduc073
11-18-2008, 02:15 PM
Can anyone help me, please? I am so tired now.

jasonJ
11-18-2008, 05:39 PM
It seems like you want to do some js code before opening an url.

In Flash:
import flash.external.*;

open_btn.onRelease = function() {
ExternalInterface.call("openWindow");
};

In html file (the one in which you embed your flash movie):
function openWindow() {
//do some js code and then open a new window
window.open("http://www.actionscript.org", "_self");
}

To better understand where you should put this code, see the attached file.

nmduc073
11-19-2008, 03:07 AM
I solved it.

on(press) {
getURL("javascript: jsABC(\"http://www.abc.com/\")");
}
on(release) {
getURL("http://www.abc.com");
}

Is it very funny? T_T I don't understand since they are not different to what I tried before.