PDA

View Full Version : Can we use Javascript in Flash?


syrinia
12-21-2001, 04:17 AM
I want to attach Javascript to a button that opens an HTML page. Is this possible?

Billy T
12-21-2001, 04:55 AM
yes

syrinia
12-21-2001, 04:58 AM
Great! So my next question is how?

I've been looking up this FSCommand stuff, but it is both over my head and seeming to do things that I'm not interested in (such as changing the scroll text at the bottom of the page).

For a normal HTML link, this is the javascript I am adding:

<a href="#" onClick="return load_iframe1('what.htm')>

How do I make this work on my Flash buttons?

Billy T
12-21-2001, 05:08 AM
is there a javascript in the head of your html page that is being called by that link?

syrinia
12-21-2001, 05:11 AM
yes...

<script language="JavaScript">
function load_iframe1(link)
{
document.all.my_iFrame1.src = link;
}
</script>

Billy T
12-21-2001, 05:16 AM
then the link on your flash buttons will be something like

on (release) {
getURL ("javascript:load_iframe1('what.htm')");
}

syrinia
12-21-2001, 05:22 AM
You have no idea how much you have helped me. Thank you so much!

Billy T
12-21-2001, 05:31 AM
welcome ;)

mpitot
01-04-2002, 03:12 PM
Very interesting indeed, and I have an other question :
I also want to call a html page, but
. not by coding into flash (like above)
. not calling a javascript function (like above in a way)
BUT by adding a param tag in Dreamweaver like <param name=LINK value="What.htm">

Does it make sense ?
How would you do that ??

I would apreciate if someone could light my candle !

Max

Billy T
01-04-2002, 10:14 PM
sorry I dont understand

cant you just use <a href> ?

mpitot
01-07-2002, 08:51 AM
Ok, my fault, I should be more clear :
I have a Flash image, and when I click on it, I want a page to be displayed, but
. not by coding into the flash source (the site has to be edited by non flash expert), neither using an external javascript file (like above), BUT (if it is possible?), by using a parameter to the embeded flash object, some thing like below:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="60" height="60">
<param name=movie value="images/Essai_Flash/FLASHforumGREY.swf">
<param name=quality value=high>
<param name=link value='what.htm'>
<embed src="images/Essai_Flash/FLASHforumGREY.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="60" height="60">
</embed>
</object>

Have you got an idea ?
Maxime

Billy T
01-07-2002, 10:34 AM
use loadvariable and load an external text file that contains something like

url=http://mysite.com

then link your button to the variable - url

the other user then just has to change the external text file

cheers

Billy T
01-07-2002, 10:39 AM
have a look at the attached file

mpitot
01-07-2002, 01:33 PM
Thank you Mister T, It's exactly what I was looking for ! I had to study the case when javascript was desactived, and it works fine !!
We're lucky to have you on board !

Happy new year, and merci breaucoup !
Max

Billy T
01-07-2002, 09:34 PM
happy new year to you too:)