How Can I Insert "Java Script" into my FLASH Website Page?

I am trying to insert a java script into a FLASH page I have built.  How can I go about doing this?

Randy
rmeffordAsked:
Who is Participating?
 
sam85281Commented:
Not clear exactly what you're doing but....

I'm gonna guess you have javascript functions in the head of your html page and you're trying to call the finctions from flash???

If that's the case, you just use:

getURL("javascript:yourFunction(arguments);");

For instance if you have a function in the head of your doc to change the background color when clicking a button in flash like this:

<script language="JavaScript">
<!--
var backImage = new Array();
backColor[0] = "blue";
backColor[1] = "lime";
backColor[2] = "white";
backColor[3] = "black";
function changeBGColor(whichColor){
if (document.body){
document.body.background = backColor[whichColor];
}
}
//-->
</script>

To call this from html would be something like:
<a href="javascript:void(0)" onClick="backColor(1);">  This would change the background to lime.

To do the same thing in flash, your button action would be:
on (release) {
getURL("javascript:backColor(1);");
}

Not sure if that's what you're trying to get at, but hope it helps.

-Sam
0
 
Harisha M GCommented:
Hi rmefford,

Just place this block between the Web page's HTML file

<script language="JavaScript" type="text/javascript">
<!--


// Your javascript code here....


//-->
</script>

Bye
---
Harish
0
 
rmeffordAuthor Commented:
Harish,

Thanks for the tip, but I don't fully understand your response.  How do I make this change in my Flash file .SFW?  Is that what you mean?

Randy
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Harisha M GCommented:
>> How do I make this change in my Flash file .SFW
No.. It is a HTML javascript.
0
 
rmeffordAuthor Commented:
Great, I actually have updated the HTML but how do I get it to work with my .sfw file now?  The HTML, works with my java script, but now I need to get it into my FLASH.
0
 
Harisha M GCommented:
May this help ?...

http://www.devpapers.com/article/109

Quote:

The easiest, and quickest way to embed your Flash animation into your page is by calling and external JavaScript or .js file, in the precise place you wish to include your Flash movie.

0
 
Harisha M GCommented:
0
 
BillystyxCommented:
or, if you need some variables from the javascript propogated into your flash, then use the flashVars parameter in your object tags, along with the js function in your html page.

Can you explain what purpose the javascript will be serving?

billystyx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.